Add missing REST Webhook implemenation (#843)
* Add Webhook API models, REST implementation, and Socket bridges. * Remove token overrides from REST. Leaving that as a Webhook package only feature. * Add Webhook API models, REST implementation, and Socket bridges. * Remove token overrides from REST. Leaving that as a Webhook package only feature. * Webhook core implementation. * Webhook REST implementation. * Webhook client implementation. * Add channel bucket id.
This commit is contained in:
committed by
Christopher F
parent
a19ff188e9
commit
7b2ddd027c
@@ -112,10 +112,26 @@ namespace Discord.WebSocket
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
//Webhooks
|
||||
public Task<RestWebhook> CreateWebhookAsync(string name, Stream avatar = null, RequestOptions options = null)
|
||||
=> ChannelHelper.CreateWebhookAsync(this, Discord, name, avatar, options);
|
||||
public Task<RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null)
|
||||
=> ChannelHelper.GetWebhookAsync(this, Discord, id, options);
|
||||
public Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null)
|
||||
=> ChannelHelper.GetWebhooksAsync(this, Discord, options);
|
||||
|
||||
private string DebuggerDisplay => $"{Name} ({Id}, Text)";
|
||||
internal new SocketTextChannel Clone() => MemberwiseClone() as SocketTextChannel;
|
||||
|
||||
//ITextChannel
|
||||
async Task<IWebhook> ITextChannel.CreateWebhookAsync(string name, Stream avatar, RequestOptions options)
|
||||
=> await CreateWebhookAsync(name, avatar, options);
|
||||
async Task<IWebhook> ITextChannel.GetWebhookAsync(ulong id, RequestOptions options)
|
||||
=> await GetWebhookAsync(id, options);
|
||||
async Task<IReadOnlyCollection<IWebhook>> ITextChannel.GetWebhooksAsync(RequestOptions options)
|
||||
=> await GetWebhooksAsync(options);
|
||||
|
||||
//IGuildChannel
|
||||
Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
|
||||
=> Task.FromResult<IGuildUser>(GetUser(id));
|
||||
|
||||
@@ -433,6 +433,12 @@ namespace Discord.WebSocket
|
||||
_downloaderPromise.TrySetResultAsync(true);
|
||||
}
|
||||
|
||||
//Webhooks
|
||||
public Task<RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null)
|
||||
=> GuildHelper.GetWebhookAsync(this, Discord, id, options);
|
||||
public Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null)
|
||||
=> GuildHelper.GetWebhooksAsync(this, Discord, options);
|
||||
|
||||
//Emotes
|
||||
public Task<GuildEmote> GetEmoteAsync(ulong id, RequestOptions options = null)
|
||||
=> GuildHelper.GetEmoteAsync(this, Discord, id, options);
|
||||
@@ -682,5 +688,10 @@ namespace Discord.WebSocket
|
||||
Task<IGuildUser> IGuild.GetOwnerAsync(CacheMode mode, RequestOptions options)
|
||||
=> Task.FromResult<IGuildUser>(Owner);
|
||||
Task IGuild.DownloadUsersAsync() { throw new NotSupportedException(); }
|
||||
|
||||
async Task<IWebhook> IGuild.GetWebhookAsync(ulong id, RequestOptions options)
|
||||
=> await GetWebhookAsync(id, options);
|
||||
async Task<IReadOnlyCollection<IWebhook>> IGuild.GetWebhooksAsync(RequestOptions options)
|
||||
=> await GetWebhooksAsync(options);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user