diff --git a/DisCatSharp/Entities/Channel/DiscordDmChannel.cs b/DisCatSharp/Entities/Channel/DiscordDmChannel.cs
index 9117a7db6..4b872ebdf 100644
--- a/DisCatSharp/Entities/Channel/DiscordDmChannel.cs
+++ b/DisCatSharp/Entities/Channel/DiscordDmChannel.cs
@@ -1,106 +1,93 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2021-2022 AITSYS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System.Collections.Generic;
using System.Globalization;
using System.Threading.Tasks;
using DisCatSharp.Enums;
+using DisCatSharp.Exceptions;
using DisCatSharp.Net;
using Newtonsoft.Json;
namespace DisCatSharp.Entities;
///
/// Represents a direct message channel.
///
public class DiscordDmChannel : DiscordChannel
{
///
/// Gets the recipients of this direct message.
///
[JsonProperty("recipients", NullValueHandling = NullValueHandling.Ignore)]
public IReadOnlyList Recipients { get; internal set; }
///
/// Gets the hash of this channel's icon.
///
[JsonProperty("icon", NullValueHandling = NullValueHandling.Ignore)]
public string IconHash { get; internal set; }
///
/// Gets the id of this direct message's creator.
///
[JsonProperty("owner_id", NullValueHandling = NullValueHandling.Ignore)]
public ulong OwnerId { get; internal set; }
///
/// Gets the application id of the direct message's creator if it a bot.
///
[JsonProperty("application_id", NullValueHandling = NullValueHandling.Ignore)]
public ulong ApplicationId { get; internal set; }
///
/// Gets the URL of this channel's icon.
///
[JsonIgnore]
public string IconUrl
=> !string.IsNullOrWhiteSpace(this.IconHash) ? $"{DiscordDomain.GetDomain(CoreDomain.DiscordCdn).Url}{Endpoints.CHANNEL_ICONS}/{this.Id.ToString(CultureInfo.InvariantCulture)}/{this.IconHash}.png" : null;
-
-#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved
-#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved
-#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved
-///
+ ///
/// Only use for Group DMs! Whitelisted bots only. Requires user's oauth2 access token.
///
/// The id of the user to add.
/// The OAuth2 access token.
/// The nickname to give to the user.
/// Thrown when the channel does not exist.
/// Thrown when an invalid parameter was provided.
/// Thrown when Discord is unable to process the request.
public Task AddDmRecipientAsync(ulong userId, string accessToken, string nickname)
-#pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved
-#pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved
-#pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved
=> this.Discord.ApiClient.AddGroupDmRecipientAsync(this.Id, userId, accessToken, nickname);
-
-#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved
-#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved
-#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved
-///
+ ///
/// Only use for Group DMs! Whitelisted bots only. Requires user's oauth2 access token.
///
/// The id of the User to remove.
/// The OAuth2 access token.
/// Thrown when the channel does not exist.
/// Thrown when an invalid parameter was provided.
/// Thrown when Discord is unable to process the request.
public Task RemoveDmRecipientAsync(ulong userId, string accessToken)
-#pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved
-#pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved
-#pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved
=> this.Discord.ApiClient.RemoveGroupDmRecipientAsync(this.Id, userId);
}
diff --git a/DisCatSharp/Entities/DCS/DisCatSharpTeam.cs b/DisCatSharp/Entities/DCS/DisCatSharpTeam.cs
index 01ec029cd..68ff7a26e 100644
--- a/DisCatSharp/Entities/DCS/DisCatSharpTeam.cs
+++ b/DisCatSharp/Entities/DCS/DisCatSharpTeam.cs
@@ -1,200 +1,206 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2021-2022 AITSYS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using DisCatSharp.Enums;
using DisCatSharp.Net;
using DisCatSharp.Net.Abstractions;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
namespace DisCatSharp.Entities;
///
/// The DisCatSharp team.
///
public sealed class DisCatSharpTeam : SnowflakeObject
{
///
/// Gets the team's name.
///
public string TeamName { get; internal set; }
+ ///
+ /// Gets the overall owner.
+ ///
+ public string Owner
+ => "Lala Sabathil";
+
///
/// Gets the team's icon.
///
public string Icon
=> !string.IsNullOrWhiteSpace(this.IconHash) ? $"{DiscordDomain.GetDomain(CoreDomain.DiscordCdn).Url}{Endpoints.TEAM_ICONS}/{this.Id.ToString(CultureInfo.InvariantCulture)}/{this.IconHash}.png?size=1024" : null;
///
/// Gets the team's icon's hash.
///
public string IconHash { get; internal set; }
///
/// Gets the team's logo.
///
public string Logo
=> !string.IsNullOrWhiteSpace(this.LogoHash) ? $"{DiscordDomain.GetDomain(CoreDomain.DiscordCdn).Url}{Endpoints.ICONS}/{this.GuildId.ToString(CultureInfo.InvariantCulture)}/{this.LogoHash}.png?size=1024" : null;
///
/// Gets the team's logo's hash.
///
public string LogoHash { get; internal set; }
///
/// Gets the team's banner.
///
public string Banner
=> !string.IsNullOrWhiteSpace(this.BannerHash) ? $"{DiscordDomain.GetDomain(CoreDomain.DiscordCdn).Url}{Endpoints.BANNERS}/{this.GuildId.ToString(CultureInfo.InvariantCulture)}/{this.BannerHash}.png?size=1024" : null;
///
/// Gets the team's banner's hash.
///
public string BannerHash { get; internal set; }
///
/// Gets the team's docs url.
///
public string DocsUrl { get; internal set; }
///
/// Gets the team's repo url.
///
public string RepoUrl { get; internal set; }
///
/// Gets the team's terms of service url.
///
public string TermsOfServiceUrl { get; internal set; }
///
/// Gets the team's privacy policy url.
///
public string PrivacyPolicyUrl { get; internal set; }
///
/// Get's the team's guild id
///
public ulong GuildId { get; internal set; }
///
/// Gets the team's developers.
///
public IReadOnlyList Developers { get; internal set; }
///
/// Gets the team's owner.
///
public DisCatSharpTeamMember Owner { get; internal set; }
///
/// Gets the team's guild.
///
public DiscordGuild Guild { get; internal set; }
///
/// Gets the team's support invite.
///
public DiscordInvite SupportInvite { get; internal set; }
///
/// Initializes a new instance of the class.
///
internal static async Task Get(HttpClient http, ILogger logger, DiscordApiClient apiClient)
{
try
{
var dcs = await http.GetStringAsync(new Uri("https://dcs.aitsys.dev/api/devs/"));
var dcsGuild = await http.GetStringAsync(new Uri("https://dcs.aitsys.dev/api/guild/"));
var app = JsonConvert.DeserializeObject(dcs);
var guild = JsonConvert.DeserializeObject(dcsGuild);
var dcst = new DisCatSharpTeam
{
IconHash = app.Team.IconHash,
TeamName = app.Team.Name,
PrivacyPolicyUrl = app.PrivacyPolicyUrl,
TermsOfServiceUrl = app.TermsOfServiceUrl,
RepoUrl = "https://github.com/Aiko-IT-Systems/DisCatSharp",
DocsUrl = "https://docs.dcs.aitsys.dev",
Id = app.Team.Id,
BannerHash = guild.BannerHash,
LogoHash = guild.IconHash,
GuildId = guild.Id,
Guild = guild,
SupportInvite = await apiClient.GetInviteAsync("GGYSywkxwN", true, true, null)
};
List team = new();
DisCatSharpTeamMember owner = new();
foreach (var mb in app.Team.Members.OrderBy(m => m.User.Username))
{
var tuser = await apiClient.GetUserAsync(mb.User.Id);
var user = mb.User;
if (mb.User.Id == 856780995629154305)
{
owner.Id = user.Id;
owner.Username = user.Username;
owner.Discriminator = user.Discriminator;
owner.AvatarHash = user.AvatarHash;
owner.BannerHash = tuser.BannerHash;
owner.BannerColorInternal = tuser.BannerColorInternal;
team.Add(owner);
}
else
{
team.Add(new DisCatSharpTeamMember
{
Id = user.Id,
Username = user.Username,
Discriminator = user.Discriminator,
AvatarHash = user.AvatarHash,
BannerHash = tuser.BannerHash,
BannerColorInternal = tuser.BannerColorInternal
});
}
}
dcst.Owner = owner;
dcst.Developers = team;
return dcst;
}
catch (Exception ex)
{
logger.LogDebug(ex.Message);
logger.LogDebug(ex.StackTrace);
return null;
}
}
private DisCatSharpTeam() { }
}