Class DiscordRestClient
Provides a client to send REST-based requests to Discord.
Inheritance
DiscordRestClient
Implements
IDisposable
IAsyncDisposable
Assembly: Discord.Net.Rest.dll
Syntax
public class DiscordRestClient : BaseDiscordClient, IDiscordClient, IDisposable, IAsyncDisposable
Constructors
|
Improve this Doc
View Source
DiscordRestClient()
Declaration
public DiscordRestClient()
|
Improve this Doc
View Source
DiscordRestClient(DiscordRestConfig)
Declaration
public DiscordRestClient(DiscordRestConfig config)
Parameters
Type |
Name |
Description |
DiscordRestConfig |
config |
The configuration to be used with the client.
|
Properties
|
Improve this Doc
View Source
CurrentUser
Declaration
public RestSelfUser CurrentUser { get; }
Property Value
Methods
|
Improve this Doc
View Source
AddReactionAsync(UInt64, UInt64, IEmote, RequestOptions)
Declaration
public Task AddReactionAsync(ulong channelId, ulong messageId, IEmote emote, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
AddRoleAsync(UInt64, UInt64, UInt64)
Declaration
public Task AddRoleAsync(ulong guildId, ulong userId, ulong roleId)
Parameters
Returns
|
Improve this Doc
View Source
BatchEditGuildCommandPermissions(UInt64, IDictionary<UInt64, ApplicationCommandPermission[]>, RequestOptions)
Declaration
public Task<IReadOnlyCollection<GuildApplicationCommandPermission>> BatchEditGuildCommandPermissions(ulong guildId, IDictionary<ulong, ApplicationCommandPermission[]> permissions, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
BulkOverwriteGlobalCommands(ApplicationCommandProperties[], RequestOptions)
Declaration
public Task<IReadOnlyCollection<RestGlobalCommand>> BulkOverwriteGlobalCommands(ApplicationCommandProperties[] commandProperties, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
BulkOverwriteGuildCommands(ApplicationCommandProperties[], UInt64, RequestOptions)
Declaration
public Task<IReadOnlyCollection<RestGuildCommand>> BulkOverwriteGuildCommands(ApplicationCommandProperties[] commandProperties, ulong guildId, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
CreateGlobalCommand(ApplicationCommandProperties, RequestOptions)
Declaration
public Task<RestGlobalCommand> CreateGlobalCommand(ApplicationCommandProperties properties, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
CreateGuildAsync(String, IVoiceRegion, Stream, RequestOptions)
Declaration
public Task<RestGuild> CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon = null, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
CreateGuildCommand(ApplicationCommandProperties, UInt64, RequestOptions)
Declaration
public Task<RestGuildCommand> CreateGuildCommand(ApplicationCommandProperties properties, ulong guildId, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
DeleteAllGlobalCommandsAsync(RequestOptions)
Declaration
public Task DeleteAllGlobalCommandsAsync(RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetApplicationInfoAsync(RequestOptions)
Declaration
public async Task<RestApplication> GetApplicationInfoAsync(RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetChannelAsync(UInt64, RequestOptions)
Declaration
public Task<RestChannel> GetChannelAsync(ulong id, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetConnectionsAsync(RequestOptions)
Declaration
public Task<IReadOnlyCollection<RestConnection>> GetConnectionsAsync(RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetCurrentBotInfoAsync(RequestOptions)
Declaration
public async Task<RestApplication> GetCurrentBotInfoAsync(RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetCurrentUserAsync(RequestOptions)
Declaration
public async Task<RestSelfUser> GetCurrentUserAsync(RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetCurrentUserGuildMemberAsync(UInt64, RequestOptions)
Declaration
public async Task<RestGuildUser> GetCurrentUserGuildMemberAsync(ulong guildId, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetDMChannelsAsync(RequestOptions)
Declaration
public Task<IReadOnlyCollection<RestDMChannel>> GetDMChannelsAsync(RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetGlobalApplicationCommands(Boolean, String, RequestOptions)
Declaration
public Task<IReadOnlyCollection<RestGlobalCommand>> GetGlobalApplicationCommands(bool withLocalizations = false, string locale = null, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetGroupChannelsAsync(RequestOptions)
Declaration
public Task<IReadOnlyCollection<RestGroupChannel>> GetGroupChannelsAsync(RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetGuildApplicationCommands(UInt64, Boolean, String, RequestOptions)
Declaration
public Task<IReadOnlyCollection<RestGuildCommand>> GetGuildApplicationCommands(ulong guildId, bool withLocalizations = false, string locale = null, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetGuildAsync(UInt64, RequestOptions)
Declaration
public Task<RestGuild> GetGuildAsync(ulong id, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetGuildAsync(UInt64, Boolean, RequestOptions)
Declaration
public Task<RestGuild> GetGuildAsync(ulong id, bool withCounts, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetGuildsAsync(RequestOptions)
Declaration
public Task<IReadOnlyCollection<RestGuild>> GetGuildsAsync(RequestOptions options = null)
Parameters
Returns
Type |
Description |
Task<IReadOnlyCollection<RestGuild>> |
|
|
Improve this Doc
View Source
GetGuildsAsync(Boolean, RequestOptions)
Declaration
public Task<IReadOnlyCollection<RestGuild>> GetGuildsAsync(bool withCounts, RequestOptions options = null)
Parameters
Returns
Type |
Description |
Task<IReadOnlyCollection<RestGuild>> |
|
|
Improve this Doc
View Source
GetGuildSummariesAsync(RequestOptions)
Declaration
public IAsyncEnumerable<IReadOnlyCollection<RestUserGuild>> GetGuildSummariesAsync(RequestOptions options = null)
Parameters
Returns
Type |
Description |
IAsyncEnumerable<IReadOnlyCollection<RestUserGuild>> |
|
|
Improve this Doc
View Source
GetGuildSummariesAsync(UInt64, Int32, RequestOptions)
Declaration
public IAsyncEnumerable<IReadOnlyCollection<RestUserGuild>> GetGuildSummariesAsync(ulong fromGuildId, int limit, RequestOptions options = null)
Parameters
Returns
Type |
Description |
IAsyncEnumerable<IReadOnlyCollection<RestUserGuild>> |
|
|
Improve this Doc
View Source
GetGuildUserAsync(UInt64, UInt64, RequestOptions)
Declaration
public Task<RestGuildUser> GetGuildUserAsync(ulong guildId, ulong id, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
Declaration
public Task<RestGuildWidget?> GetGuildWidgetAsync(ulong id, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetInviteAsync(String, RequestOptions, Nullable<UInt64>)
Declaration
public Task<RestInviteMetadata> GetInviteAsync(string inviteId, RequestOptions options = null, ulong? scheduledEventId = null)
Parameters
Returns
|
Improve this Doc
View Source
GetPrivateChannelsAsync(RequestOptions)
Declaration
public Task<IReadOnlyCollection<IRestPrivateChannel>> GetPrivateChannelsAsync(RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
Declaration
public Task<IReadOnlyCollection<RoleConnectionMetadata>> GetRoleConnectionMetadataRecordsAsync(RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetUserApplicationRoleConnectionAsync(UInt64, RequestOptions)
Declaration
public Task<RoleConnection> GetUserApplicationRoleConnectionAsync(ulong applicationId, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetUserAsync(UInt64, RequestOptions)
Declaration
public Task<RestUser> GetUserAsync(ulong id, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetVoiceRegionAsync(String, RequestOptions)
Declaration
public Task<RestVoiceRegion> GetVoiceRegionAsync(string id, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetVoiceRegionsAsync(RequestOptions)
Declaration
public Task<IReadOnlyCollection<RestVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
GetWebhookAsync(UInt64, RequestOptions)
Declaration
public Task<RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
IsValidHttpInteraction(String, String, String, Byte[])
Declaration
public bool IsValidHttpInteraction(string publicKey, string signature, string timestamp, byte[] body)
Parameters
Returns
|
Improve this Doc
View Source
IsValidHttpInteraction(String, String, String, String)
Declaration
public bool IsValidHttpInteraction(string publicKey, string signature, string timestamp, string body)
Parameters
Returns
|
Improve this Doc
View Source
ModifyCurrentBotApplicationAsync(Action<ModifyApplicationProperties>, RequestOptions)
Declaration
public async Task<RestApplication> ModifyCurrentBotApplicationAsync(Action<ModifyApplicationProperties> args, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
Declaration
public Task<IReadOnlyCollection<RoleConnectionMetadata>> ModifyRoleConnectionMetadataRecordsAsync(ICollection<RoleConnectionMetadataProperties> metadata, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
ModifyUserApplicationRoleConnectionAsync(UInt64, RoleConnectionProperties, RequestOptions)
Declaration
public Task<RoleConnection> ModifyUserApplicationRoleConnectionAsync(ulong applicationId, RoleConnectionProperties roleConnection, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
ParseHttpInteractionAsync(String, String, String, Byte[], Func<InteractionProperties, Boolean>)
Declaration
public async Task<RestInteraction> ParseHttpInteractionAsync(string publicKey, string signature, string timestamp, byte[] body, Func<InteractionProperties, bool> doApiCallOnCreation = null)
Parameters
Type |
Name |
Description |
String |
publicKey |
The public key of your application
|
String |
signature |
The signature sent with the interaction.
|
String |
timestamp |
The timestamp sent with the interaction.
|
Byte[] |
body |
The body of the http message.
|
Func<InteractionProperties, Boolean> |
doApiCallOnCreation |
|
Returns
Exceptions
|
Improve this Doc
View Source
ParseHttpInteractionAsync(String, String, String, String, Func<InteractionProperties, Boolean>)
Declaration
public Task<RestInteraction> ParseHttpInteractionAsync(string publicKey, string signature, string timestamp, string body, Func<InteractionProperties, bool> doApiCallOnCreation = null)
Parameters
Type |
Name |
Description |
String |
publicKey |
The public key of your application
|
String |
signature |
The signature sent with the interaction.
|
String |
timestamp |
The timestamp sent with the interaction.
|
String |
body |
The body of the http message.
|
Func<InteractionProperties, Boolean> |
doApiCallOnCreation |
|
Returns
Exceptions
|
Improve this Doc
View Source
RemoveAllReactionsAsync(UInt64, UInt64, RequestOptions)
Declaration
public Task RemoveAllReactionsAsync(ulong channelId, ulong messageId, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
RemoveAllReactionsForEmoteAsync(UInt64, UInt64, IEmote, RequestOptions)
Declaration
public Task RemoveAllReactionsForEmoteAsync(ulong channelId, ulong messageId, IEmote emote, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
RemoveReactionAsync(UInt64, UInt64, UInt64, IEmote, RequestOptions)
Declaration
public Task RemoveReactionAsync(ulong channelId, ulong messageId, ulong userId, IEmote emote, RequestOptions options = null)
Parameters
Returns
|
Improve this Doc
View Source
RemoveRoleAsync(UInt64, UInt64, UInt64)
Declaration
public Task RemoveRoleAsync(ulong guildId, ulong userId, ulong roleId)
Parameters
Returns
Implements
IDisposable
IAsyncDisposable
Extension Methods