Browse Source

Fix casing of 'discord'

pull/988/head
Hsu Still 7 years ago
parent
commit
5304524f5f
No known key found for this signature in database GPG Key ID: 8601A145FDA95209
2 changed files with 14 additions and 10 deletions
  1. +2
    -2
      src/Discord.Net.WebSocket/DiscordSocketClient.cs
  2. +12
    -8
      src/Discord.Net.Webhook/DiscordWebhookClient.cs

+ 2
- 2
src/Discord.Net.WebSocket/DiscordSocketClient.cs View File

@@ -68,9 +68,9 @@ namespace Discord.WebSocket
=> State.PrivateChannels.Select(x => x as SocketGroupChannel).Where(x => x != null).ToImmutableArray(); => State.PrivateChannels.Select(x => x as SocketGroupChannel).Where(x => x != null).ToImmutableArray();
public override IReadOnlyCollection<RestVoiceRegion> VoiceRegions => _voiceRegions.ToReadOnlyCollection(); public override IReadOnlyCollection<RestVoiceRegion> VoiceRegions => _voiceRegions.ToReadOnlyCollection();


/// <summary> Creates a new REST/WebSocket discord client. </summary>
/// <summary> Creates a new REST/WebSocket Discord client. </summary>
public DiscordSocketClient() : this(new DiscordSocketConfig()) { } public DiscordSocketClient() : this(new DiscordSocketConfig()) { }
/// <summary> Creates a new REST/WebSocket discord client. </summary>
/// <summary> Creates a new REST/WebSocket Discord client. </summary>
public DiscordSocketClient(DiscordSocketConfig config) : this(config, CreateApiClient(config), null, null) { } public DiscordSocketClient(DiscordSocketConfig config) : this(config, CreateApiClient(config), null, null) { }
internal DiscordSocketClient(DiscordSocketConfig config, SemaphoreSlim groupLock, DiscordSocketClient parentClient) : this(config, CreateApiClient(config), groupLock, parentClient) { } internal DiscordSocketClient(DiscordSocketConfig config, SemaphoreSlim groupLock, DiscordSocketClient parentClient) : this(config, CreateApiClient(config), groupLock, parentClient) { }
private DiscordSocketClient(DiscordSocketConfig config, API.DiscordSocketApiClient client, SemaphoreSlim groupLock, DiscordSocketClient parentClient) private DiscordSocketClient(DiscordSocketConfig config, API.DiscordSocketApiClient client, SemaphoreSlim groupLock, DiscordSocketClient parentClient)


+ 12
- 8
src/Discord.Net.Webhook/DiscordWebhookClient.cs View File

@@ -7,6 +7,7 @@ using Discord.Rest;


namespace Discord.Webhook namespace Discord.Webhook
{ {
/// <summary> A client responsible for connecting as a Webhook. </summary>
public class DiscordWebhookClient : IDisposable public class DiscordWebhookClient : IDisposable
{ {
public event Func<LogMessage, Task> Log { add { _logEvent.Add(value); } remove { _logEvent.Remove(value); } } public event Func<LogMessage, Task> Log { add { _logEvent.Add(value); } remove { _logEvent.Remove(value); } }
@@ -19,14 +20,14 @@ namespace Discord.Webhook
internal API.DiscordRestApiClient ApiClient { get; } internal API.DiscordRestApiClient ApiClient { get; }
internal LogManager LogManager { get; } internal LogManager LogManager { get; }


/// <summary> Creates a new Webhook discord client. </summary>
/// <summary> Creates a new Webhook Discord client. </summary>
public DiscordWebhookClient(IWebhook webhook) public DiscordWebhookClient(IWebhook webhook)
: this(webhook.Id, webhook.Token, new DiscordRestConfig()) { } : this(webhook.Id, webhook.Token, new DiscordRestConfig()) { }
/// <summary> Creates a new Webhook discord client. </summary>
/// <summary> Creates a new Webhook Discord client. </summary>
public DiscordWebhookClient(ulong webhookId, string webhookToken) public DiscordWebhookClient(ulong webhookId, string webhookToken)
: this(webhookId, webhookToken, new DiscordRestConfig()) { } : this(webhookId, webhookToken, new DiscordRestConfig()) { }


/// <summary> Creates a new Webhook discord client. </summary>
/// <summary> Creates a new Webhook Discord client. </summary>
public DiscordWebhookClient(ulong webhookId, string webhookToken, DiscordRestConfig config) public DiscordWebhookClient(ulong webhookId, string webhookToken, DiscordRestConfig config)
: this(config) : this(config)
{ {
@@ -34,7 +35,7 @@ namespace Discord.Webhook
ApiClient.LoginAsync(TokenType.Webhook, webhookToken).GetAwaiter().GetResult(); ApiClient.LoginAsync(TokenType.Webhook, webhookToken).GetAwaiter().GetResult();
Webhook = WebhookClientHelper.GetWebhookAsync(this, webhookId).GetAwaiter().GetResult(); Webhook = WebhookClientHelper.GetWebhookAsync(this, webhookId).GetAwaiter().GetResult();
} }
/// <summary> Creates a new Webhook discord client. </summary>
/// <summary> Creates a new Webhook Discord client. </summary>
public DiscordWebhookClient(IWebhook webhook, DiscordRestConfig config) public DiscordWebhookClient(IWebhook webhook, DiscordRestConfig config)
: this(config) : this(config)
{ {
@@ -61,19 +62,22 @@ namespace Discord.Webhook
} }
private static API.DiscordRestApiClient CreateApiClient(DiscordRestConfig config) private static API.DiscordRestApiClient CreateApiClient(DiscordRestConfig config)
=> new API.DiscordRestApiClient(config.RestClientProvider, DiscordRestConfig.UserAgent); => new API.DiscordRestApiClient(config.RestClientProvider, DiscordRestConfig.UserAgent);
/// <summary> Sends a message using to the channel for this webhook. Returns the ID of the created message. </summary>

/// <summary> Sends a message using to the channel for this webhook. </summary>
/// <returns> Returns the ID of the created message. </returns>
public Task<ulong> SendMessageAsync(string text, bool isTTS = false, IEnumerable<Embed> embeds = null, public Task<ulong> SendMessageAsync(string text, bool isTTS = false, IEnumerable<Embed> embeds = null,
string username = null, string avatarUrl = null, RequestOptions options = null) string username = null, string avatarUrl = null, RequestOptions options = null)
=> WebhookClientHelper.SendMessageAsync(this, text, isTTS, embeds, username, avatarUrl, options); => WebhookClientHelper.SendMessageAsync(this, text, isTTS, embeds, username, avatarUrl, options);


#if FILESYSTEM #if FILESYSTEM
/// <summary> Send a message to the channel for this webhook with an attachment. Returns the ID of the created message. </summary>
/// <summary> Sends a message to the channel for this webhook with an attachment. </summary>
/// <returns> Returns the ID of the created message. </returns>
public Task<ulong> SendFileAsync(string filePath, string text, bool isTTS = false, public Task<ulong> SendFileAsync(string filePath, string text, bool isTTS = false,
IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null, RequestOptions options = null) IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null, RequestOptions options = null)
=> WebhookClientHelper.SendFileAsync(this, filePath, text, isTTS, embeds, username, avatarUrl, options); => WebhookClientHelper.SendFileAsync(this, filePath, text, isTTS, embeds, username, avatarUrl, options);
#endif #endif
/// <summary> Send a message to the channel for this webhook with an attachment. Returns the ID of the created message. </summary>
/// <summary> Sends a message to the channel for this webhook with an attachment. </summary>
/// <returns> Returns the ID of the created message. </returns>
public Task<ulong> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, public Task<ulong> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false,
IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null, RequestOptions options = null) IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null, RequestOptions options = null)
=> WebhookClientHelper.SendFileAsync(this, stream, filename, text, isTTS, embeds, username, avatarUrl, options); => WebhookClientHelper.SendFileAsync(this, stream, filename, text, isTTS, embeds, username, avatarUrl, options);


Loading…
Cancel
Save