/// <summary> /// Create a guild scheduled event in the guild. /// Returns a <see cref="GuildScheduledEvent">guild scheduled event</see> object on success. /// See <a href="https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event">Create Guild Scheduled Event</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="guildId">Guild to create event in</param> /// <param name="create">Guild Scheduled Event to create</param> /// <param name="callback">Callback with the created scheduled events</param> /// <param name="error">Callback when an error occurs with error information</param> public static void Create(DiscordClient client, Snowflake guildId, ScheduledEventCreate create, Action <GuildScheduledEvent> callback = null, Action <RestError> error = null) { if (!guildId.IsValid()) { throw new InvalidSnowflakeException(nameof(guildId)); } client.Bot.Rest.DoRequest($"/guilds/{guildId}/scheduled-events", RequestMethod.POST, create, callback, error); }
/// <summary> /// Follow a News Channel to send messages to a target channel. /// Requires the MANAGE_WEBHOOKS permission in the target channel. /// See <a href="https://discord.com/developers/docs/resources/channel#follow-news-channel">Delete Channel Permission</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="webhookChannelId">ID of target channel</param> /// <param name="callback">callback with the followed channel</param> /// <param name="error">Callback when an error occurs with error information</param> public void FollowNewsChannel(DiscordClient client, Snowflake webhookChannelId, Action <FollowedChannel> callback = null, Action <RestError> error = null) { if (!webhookChannelId.IsValid()) { throw new InvalidSnowflakeException(nameof(webhookChannelId)); } client.Bot.Rest.DoRequest($"/channels/{Id}/followers?webhook_channel_id={webhookChannelId}", RequestMethod.POST, null, callback, error); }
/// <summary> /// Gets the stage instance associated with the Stage channel, if it exists. /// See <a href="https://discord.com/developers/docs/resources/stage-instance#get-stage-instance">Get Stage Instance</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="channelId">Channel ID to get the stage instance for</param> /// <param name="callback">Callback with the new stage instance</param> /// <param name="error">Callback when an error occurs with error information</param> public static void GetStageInstance(DiscordClient client, Snowflake channelId, Action <StageInstance> callback = null, Action <RestError> error = null) { if (!channelId.IsValid()) { throw new InvalidSnowflakeException(nameof(channelId)); } client.Bot.Rest.DoRequest($"/stage-instances/{channelId}", RequestMethod.GET, null, callback, error); }
/// <summary> /// Returns a list of guild webhooks /// See <a href="https://discord.com/developers/docs/resources/webhook#get-guild-webhooks">Get Guild Webhooks</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="guildId">Guild ID to get webhooks for</param> /// <param name="callback">Callback with the list of guild webhooks</param> /// <param name="error">Callback when an error occurs with error information</param> public static void GetGuildWebhooks(DiscordClient client, Snowflake guildId, Action <List <DiscordWebhook> > callback = null, Action <RestError> error = null) { if (!guildId.IsValid()) { throw new InvalidSnowflakeException(nameof(guildId)); } client.Bot.Rest.DoRequest($"/guilds/{guildId}/webhooks", RequestMethod.GET, null, callback, error); }
/// <summary> /// Returns the webhook with the given ID & Token /// This call does not required authentication /// No user is returned in webhook object /// See <a href="https://discord.com/developers/docs/resources/webhook#get-webhook-with-token">Get Webhook with Token</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="webhookId">Webhook ID to get</param> /// <param name="webhookToken">Webhook Token</param> /// <param name="callback">Callback with the webhook</param> /// <param name="error">Callback when an error occurs with error information</param> public static void GetWebhookWithToken(DiscordClient client, Snowflake webhookId, string webhookToken, Action <DiscordWebhook> callback = null, Action <RestError> error = null) { if (!webhookId.IsValid()) { throw new InvalidSnowflakeException(nameof(webhookId)); } client.Bot.Rest.DoRequest($"/webhooks/{webhookId}/{webhookToken}", RequestMethod.GET, null, callback, error); }
/// <summary> /// Fetches command permissions for a specific command for your application in a guild. Returns a GuildApplicationCommandPermissions object. /// </summary> /// <param name="client">Client to use</param> /// <param name="guildId">Guild ID of the guild to get permissions for</param> /// <param name="callback">Callback with the permissions for the command</param> /// <param name="error">Callback when an error occurs with error information</param> public void GetPermissions(DiscordClient client, Snowflake guildId, Action <GuildCommandPermissions> callback = null, Action <RestError> error = null) { if (!guildId.IsValid()) { throw new InvalidSnowflakeException(nameof(guildId)); } client.Bot.Rest.DoRequest($"/applications/{ApplicationId}/guilds/{guildId}/commands/{Id}/permissions", RequestMethod.GET, null, callback, error); }
/// <summary> /// Deletes a followup message for an Interaction /// See <a href="https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message">Delete Followup Message</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="messageId">Message ID to delete</param> /// <param name="callback">Callback with the updated message</param> /// <param name="error">Callback when an error occurs with error information</param> public void DeleteFollowUpMessage(DiscordClient client, Snowflake messageId, Action callback = null, Action <RestError> error = null) { if (!messageId.IsValid()) { throw new InvalidSnowflakeException(nameof(messageId)); } client.Bot.Rest.DoRequest($"/webhooks/{ApplicationId}/{Token}/messages/{messageId}", RequestMethod.DELETE, null, callback, error); }
/// <summary> /// Returns a thread member object for the specified user if they are a member of the thread /// returns a 404 response otherwise. /// See <a href="https://discord.com/developers/docs/resources/channel#get-thread-member">Remove Thread Member</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="userId">ID of the user to thread</param> /// <param name="callback">Callback with the thread member</param> /// <param name="error">Callback when an error occurs with error information</param> public void GetThreadMember(DiscordClient client, Snowflake userId, Action <ThreadMember> callback = null, Action <RestError> error = null) { if (!userId.IsValid()) { throw new InvalidSnowflakeException(nameof(userId)); } client.Bot.Rest.DoRequest($"/channels/{Id}/thread-members/{userId}", RequestMethod.GET, null, callback, error); }
/// <summary> /// Leave the guild that the currently logged in user is in /// See <a href="https://discord.com/developers/docs/resources/user#leave-guild">Leave Guild</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="guildId">Guild ID to leave</param> /// <param name="callback">callback when the action is completed</param> /// <param name="error">Callback when an error occurs with error information</param> public void LeaveGuild(DiscordClient client, Snowflake guildId, Action callback = null, Action <RestError> error = null) { if (!guildId.IsValid()) { throw new InvalidSnowflakeException(nameof(guildId)); } client.Bot.Rest.DoRequest($"/users/@me/guilds/{guildId}", RequestMethod.DELETE, null, callback, error); }
/// <summary> /// Removes a recipient from a Group DM /// See <a href="https://discord.com/developers/docs/resources/channel#group-dm-remove-recipient">Group DM Remove Recipient</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="userId">User ID to remove</param> /// <param name="callback">Callback once the action is completed</param> /// <param name="error">Callback when an error occurs with error information</param> public void GroupDmRemoveRecipient(DiscordClient client, Snowflake userId, Action callback = null, Action <RestError> error = null) { if (!userId.IsValid()) { throw new InvalidSnowflakeException(nameof(userId)); } client.Bot.Rest.DoRequest($"/channels/{Id}/recipients/{userId}", RequestMethod.DELETE, null, callback, error); }
/// <summary> /// Creates a new public thread from a message /// See <a href="https://discord.com/developers/docs/resources/channel#start-thread-with-message">Start Thread with Message</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="messageId">ID of the message to start the thread from</param> /// <param name="create">Data to use when creating the thread</param> /// <param name="callback">Callback with the thread once the action is completed</param> /// <param name="error">Callback when an error occurs with error information</param> public void StartThreadWithMessage(DiscordClient client, Snowflake messageId, ThreadCreate create, Action <DiscordChannel> callback = null, Action <RestError> error = null) { if (!messageId.IsValid()) { throw new InvalidSnowflakeException(nameof(messageId)); } client.Bot.Rest.DoRequest($"/channels/{Id}/messages/{messageId}/threads", RequestMethod.POST, create, callback, error); }
/// <summary> /// Returns a list of guild scheduled event objects for the given guild. /// See <a href="https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild">List Scheduled Events for Guild</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="guildId">Guild to get events for</param> /// <param name="lookup">Query string parameters</param> /// <param name="callback">Callback with the list of scheduled events</param> /// <param name="error">Callback when an error occurs with error information</param> public static void ListForGuild(DiscordClient client, Snowflake guildId, ScheduledEventLookup lookup = null, Action <List <GuildScheduledEvent> > callback = null, Action <RestError> error = null) { if (!guildId.IsValid()) { throw new InvalidSnowflakeException(nameof(guildId)); } client.Bot.Rest.DoRequest($"/guilds/{guildId}/scheduled-events{lookup?.ToQueryString()}", RequestMethod.GET, null, callback, error); }
/// <summary> /// Crosspost a message in a News Channel to following channels. /// This endpoint requires the 'SEND_MESSAGES' permission, if the current user sent the message, or additionally the 'MANAGE_MESSAGES' permission, for all other messages, to be present for the current user. /// See <a href="https://discord.com/developers/docs/resources/channel#crosspost-message">Crosspost Message</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="messageId">Message ID to cross post</param> /// <param name="callback">Callback with the cross posted message</param> /// <param name="error">Callback when an error occurs with error information</param> public void CrossPostMessage(DiscordClient client, Snowflake messageId, Action <DiscordMessage> callback = null, Action <RestError> error = null) { if (!messageId.IsValid()) { throw new InvalidSnowflakeException(nameof(messageId)); } client.Bot.Rest.DoRequest($"/channels/{Id}/messages/{messageId}/crosspost", RequestMethod.POST, null, callback, error); }
/// <summary> /// Deletes another user's reaction. /// This endpoint requires the 'MANAGE_MESSAGES' permission to be present on the current user. /// Valid emoji formats are the unicode emoji character '😀' or for custom emoji format must be <emojiName:emojiId> /// See <a href="https://discord.com/developers/docs/resources/channel#delete-user-reaction">Delete User Reaction</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="emoji">Emoji to delete</param> /// <param name="userId">User ID who add the reaction</param> /// <param name="callback">Callback once the action is completed</param> /// <param name="error">Callback when an error occurs with error information</param> public void DeleteUserReaction(DiscordClient client, DiscordEmoji emoji, Snowflake userId, Action callback = null, Action <RestError> error = null) { if (!userId.IsValid()) { throw new InvalidSnowflakeException(nameof(userId)); } DeleteUserReaction(client, emoji.ToDataString(), userId, callback, error); }
/// <summary> /// Delete a channel permission overwrite for a user or role in a channel. /// Only usable for guild channels. /// Requires the MANAGE_ROLES permission. /// See <a href="https://discord.com/developers/docs/resources/channel#delete-channel-permission">Delete Channel Permission</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="overwriteId">Overwrite ID to delete</param> /// <param name="callback">Callback once the action is completed</param> /// <param name="error">Callback when an error occurs with error information</param> public void DeleteChannelPermission(DiscordClient client, Snowflake overwriteId, Action callback = null, Action <RestError> error = null) { if (!overwriteId.IsValid()) { throw new InvalidSnowflakeException(nameof(overwriteId)); } client.Bot.Rest.DoRequest($"/channels/{Id}/permissions/{overwriteId}", RequestMethod.DELETE, null, callback, error); }
/// <summary> /// Create a new channel object for the guild. /// Requires the MANAGE_CHANNELS permission. /// See <a href="https://discord.com/developers/docs/resources/guild#create-guild-channel">Create Guild Channel</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="guildId">Guild to create the channel in</param> /// <param name="channel">Channel to create</param> /// <param name="callback">Callback with created channel</param> /// <param name="error">Callback when an error occurs with error information</param> public static void CreateGuildChannel(DiscordClient client, Snowflake guildId, ChannelCreate channel, Action <DiscordChannel> callback = null, Action <RestError> error = null) { if (!guildId.IsValid()) { throw new InvalidSnowflakeException(nameof(guildId)); } client.Bot.Rest.DoRequest($"/guilds/{guildId}/channels", RequestMethod.POST, channel, callback, error); }
/// <summary> /// Edits a followup message for an Interaction /// See <a href="https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message">Edit Followup Message</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="messageId">Message ID of the follow up message</param> /// <param name="edit">Updated message</param> /// <param name="callback">Callback with the updated message</param> /// <param name="error">Callback when an error occurs with error information</param> public void EditFollowUpMessage(DiscordClient client, Snowflake messageId, CommandFollowupUpdate edit, Action <DiscordMessage> callback = null, Action <RestError> error = null) { if (!messageId.IsValid()) { throw new InvalidSnowflakeException(nameof(messageId)); } client.Bot.Rest.DoRequest($"/webhooks/{ApplicationId}/{Token}/messages/{messageId}", RequestMethod.PATCH, edit, callback, error); }
/// <summary> /// Returns a sticker object for the given sticker ID. /// See <a href="https://discord.com/developers/docs/resources/sticker#get-sticker">Get Sticker</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="stickerId">ID of the sticker</param> /// <param name="callback">Callback with the DiscordSticker</param> /// <param name="error">Callback when an error occurs with error information</param> public static void GetSticker(DiscordClient client, Snowflake stickerId, Action <DiscordSticker> callback, Action <RestError> error = null) { if (!stickerId.IsValid()) { throw new InvalidSnowflakeException(nameof(stickerId)); } client.Bot.Rest.DoRequest($"/stickers/{stickerId}", RequestMethod.GET, null, callback, error); }
/// <summary> /// Post a message to a guild text or DM channel. /// If operating on a guild channel, this endpoint requires the SEND_MESSAGES permission to be present on the current user. /// If the tts field is set to true, the SEND_TTS_MESSAGES permission is required for the message to be spoken. /// See <a href="https://discord.com/developers/docs/resources/channel#create-message">Create Message</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="channelId">Channel ID to send the message to</param> /// <param name="message">Message to be created</param> /// <param name="callback">Callback with the created message</param> /// <param name="error">Callback when an error occurs with error information</param> public static void CreateMessage(DiscordClient client, Snowflake channelId, MessageCreate message, Action <DiscordMessage> callback = null, Action <RestError> error = null) { if (!channelId.IsValid()) { throw new InvalidSnowflakeException(nameof(channelId)); } message.Validate(); message.ValidateChannelMessage(); client.Bot.Rest.DoRequest($"/channels/{channelId}/messages", RequestMethod.POST, message, callback, error); }
/// <summary> /// Deletes another user's reaction. /// This endpoint requires the 'MANAGE_MESSAGES' permission to be present on the current user. /// Valid emoji formats are the unicode emoji character '😀' or for custom emoji format must be <emojiName:emojiId> /// See <a href="https://discord.com/developers/docs/resources/channel#delete-user-reaction">Delete User Reaction</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="emoji">Emoji to delete</param> /// <param name="userId">User ID who add the reaction</param> /// <param name="callback">Callback once the action is completed</param> /// <param name="error">Callback when an error occurs with error information</param> public void DeleteUserReaction(DiscordClient client, string emoji, Snowflake userId, Action callback = null, Action <RestError> error = null) { if (!userId.IsValid()) { throw new InvalidSnowflakeException(nameof(userId)); } Validation.ValidateEmoji(emoji); client.Bot.Rest.DoRequest($"/channels/{ChannelId}/messages/{Id}/reactions/{emoji}/{userId}", RequestMethod.DELETE, null, callback, error); }
/// <summary> /// Delete a guild scheduled event /// See <a href="https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event">Delete Guild Scheduled Event</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="guildId">Guild to modify event in</param> /// <param name="eventId">Id of the event to delete</param> /// <param name="callback">Callback with the updated scheduled events</param> /// <param name="error">Callback when an error occurs with error information</param> public void Delete(DiscordClient client, Snowflake guildId, Snowflake eventId, Action <GuildScheduledEvent> callback = null, Action <RestError> error = null) { if (!guildId.IsValid()) { throw new InvalidSnowflakeException(nameof(guildId)); } if (!eventId.IsValid()) { throw new InvalidSnowflakeException(nameof(eventId)); } client.Bot.Rest.DoRequest($"/guilds/{guildId}/scheduled-events/{eventId}", RequestMethod.DELETE, null, callback, error); }
/// <summary> /// Returns a specific message in the channel. /// If operating on a guild channel, this endpoint requires the 'READ_MESSAGE_HISTORY' permission to be present on the current user. /// See <a href="https://discord.com/developers/docs/resources/channel#get-channel-message">Get Channel Messages</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="channelId">Channel ID where the message is</param> /// <param name="messageId">Message ID of the message</param> /// <param name="callback">Callback with the message for the ID</param> /// <param name="error">Callback when an error occurs with error information</param> public static void GetChannelMessage(DiscordClient client, Snowflake channelId, Snowflake messageId, Action <DiscordMessage> callback = null, Action <RestError> error = null) { if (!channelId.IsValid()) { throw new InvalidSnowflakeException(nameof(channelId)); } if (!messageId.IsValid()) { throw new InvalidSnowflakeException(nameof(messageId)); } client.Bot.Rest.DoRequest($"/channels/{channelId}/messages/{messageId}", RequestMethod.GET, null, callback, error); }
/// <summary> /// Edits command permissions for a specific command for your application in a guild. /// Warning: This endpoint will overwrite existing permissions for the command in that guild /// Warning: Deleting or renaming a command will permanently delete all permissions for that command /// </summary> /// <param name="client">Client to use</param> /// <param name="guildId">Guild ID of the guild to edit permissions for</param> /// <param name="permissions">List of permissions for the command</param> /// <param name="callback">Callback with the list of permissions</param> /// <param name="error">Callback when an error occurs with error information</param> public void EditPermissions(DiscordClient client, Snowflake guildId, List <CommandPermissions> permissions, Action callback = null, Action <RestError> error = null) { if (!guildId.IsValid()) { throw new InvalidSnowflakeException(nameof(guildId)); } Dictionary <string, object> data = new Dictionary <string, object> { ["permissions"] = permissions }; client.Bot.Rest.DoRequest($"/applications/{ApplicationId}/guilds/{guildId}/commands/{Id}/permissions", RequestMethod.PUT, data, callback, error); }
/// <summary> /// Gets a previously-sent webhook message from the same token. /// See <a href="https://discord.com/developers/docs/resources/webhook#get-webhook-message">Edit Webhook Message</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="messageId">Message ID to get</param> /// <param name="messageParams">Message Params</param> /// <param name="callback">Callback with the message</param> /// <param name="error">Callback when an error occurs with error information</param> public void GetWebhookMessage(DiscordClient client, Snowflake messageId, WebhookMessageParams messageParams = null, Action <DiscordMessage> callback = null, Action <RestError> error = null) { if (!messageId.IsValid()) { throw new InvalidSnowflakeException(nameof(messageId)); } if (messageParams == null) { messageParams = new WebhookMessageParams(); } client.Bot.Rest.DoRequest($"/webhooks/{Id}/{Token}/messages/{messageId}{messageParams.ToQueryString()}", RequestMethod.GET, null, callback, error); }
/// <summary> /// Post a message to a guild text or DM channel. /// If operating on a guild channel, this endpoint requires the SEND_MESSAGES permission to be present on the current user. /// If the tts field is set to true, the SEND_TTS_MESSAGES permission is required for the message to be spoken. /// See <a href="https://discord.com/developers/docs/resources/channel#create-message">Create Message</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="channelId">Channel ID to send the message to</param> /// <param name="embeds">Embeds to be send in the message</param> /// <param name="callback">Callback with the created message</param> /// <param name="error">Callback when an error occurs with error information</param> public static void CreateMessage(DiscordClient client, Snowflake channelId, List <DiscordEmbed> embeds, Action <DiscordMessage> callback = null, Action <RestError> error = null) { if (!channelId.IsValid()) { throw new InvalidSnowflakeException(nameof(channelId)); } MessageCreate createMessage = new MessageCreate { Embeds = embeds }; CreateMessage(client, channelId, createMessage, callback, error); }
/// <summary> /// Adds a recipient to a Group DM using their access token /// See <a href="https://discord.com/developers/docs/resources/channel#group-dm-add-recipient">Group DM Add Recipient</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="userId">User to add</param> /// <param name="accessToken">Users access token</param> /// <param name="nick">User nickname</param> /// <param name="callback">Callback once the action is completed</param> /// <param name="error">Callback when an error occurs with error information</param> public void GroupDmAddRecipient(DiscordClient client, Snowflake userId, string accessToken, string nick, Action callback = null, Action <RestError> error = null) { if (!userId.IsValid()) { throw new InvalidSnowflakeException(nameof(userId)); } Dictionary <string, string> data = new Dictionary <string, string>() { ["access_token"] = accessToken, ["nick"] = nick }; client.Bot.Rest.DoRequest($"/channels/{Id}/recipients/{userId}", RequestMethod.PUT, data, callback, error); }
/// <summary> /// Create a new webhook. /// Requires the MANAGE_WEBHOOKS permission. /// See <a href="https://discord.com/developers/docs/resources/webhook#create-webhook">Create Webhook</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="channelId">Channel ID for the webhook</param> /// <param name="name">Name of the webhook (1-80 characters)</param> /// <param name="avatar">Image for the default webhook avatar</param> /// <param name="callback">Callback with the completed webhook</param> /// <param name="error">Callback when an error occurs with error information</param> public static void CreateWebhook(DiscordClient client, Snowflake channelId, string name, string avatar = null, Action <DiscordWebhook> callback = null, Action <RestError> error = null) { if (!channelId.IsValid()) { throw new InvalidSnowflakeException(nameof(channelId)); } Dictionary <string, string> data = new Dictionary <string, string> { ["name"] = name, ["avatar"] = avatar }; client.Bot.Rest.DoRequest($"/channels/{channelId}/webhooks", RequestMethod.POST, data, callback, error); }
/// <summary> /// Creates a new Stage instance associated to a Stage channel. /// Requires the user to be a moderator of the Stage channel. /// See <a href="https://discord.com/developers/docs/resources/stage-instance#create-stage-instance">Create Stage Instance</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="channelId">Channel ID to create a stage in</param> /// <param name="topic">The topic for the stage instance</param> /// <param name="privacyLevel">Privacy level for the stage instance</param> /// <param name="callback">Callback with the new stage instance</param> /// <param name="error">Callback when an error occurs with error information</param> public static void CreateStageInstance(DiscordClient client, Snowflake channelId, string topic, PrivacyLevel privacyLevel = PrivacyLevel.GuildOnly, Action <StageInstance> callback = null, Action <RestError> error = null) { if (!channelId.IsValid()) { throw new InvalidSnowflakeException(nameof(channelId)); } Dictionary <string, string> data = new Dictionary <string, string> { ["channel_id"] = channelId, ["topic"] = topic, ["privacy_level"] = ((int)privacyLevel).ToString() }; client.Bot.Rest.DoRequest($"/stage-instances", RequestMethod.POST, data, callback, error); }
/// <summary> /// Edit the channel permission overwrites for a user or role in a channel. /// Only usable for guild channels. /// Requires the MANAGE_ROLES permission. /// See <a href="https://discord.com/developers/docs/resources/channel#edit-channel-permissions">Edit Channel Permissions</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="overwriteId">ID of the overwrite to edit</param> /// <param name="allow">Allow Permission Flags</param> /// <param name="deny">Deny Permission Flags</param> /// <param name="type">Permission Type Flag</param> /// <param name="callback">Callback once the action is complete</param> /// <param name="error">Callback when an error occurs with error information</param> public void EditChannelPermissions(DiscordClient client, Snowflake overwriteId, PermissionFlags?allow, PermissionFlags?deny, PermissionType type, Action callback = null, Action <RestError> error = null) { if (!overwriteId.IsValid()) { throw new InvalidSnowflakeException(nameof(overwriteId)); } Overwrite overwrite = new Overwrite { Id = overwriteId, Type = type, Allow = allow, Deny = deny }; EditChannelPermissions(client, overwrite, callback, error); }
/// <summary> /// Get a list of guild scheduled event users subscribed to a guild scheduled event. /// Returns a list of guild scheduled event user objects on success. /// Guild member data, if it exists, is included if the WithMember query parameter is set. /// See <a href="https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users">Get Guild Scheduled Event Users</a> /// </summary> /// <param name="client">Client to use</param> /// <param name="guildId">Guild to get event users for</param> /// <param name="eventId">Id of the event to get users for</param> /// <param name="lookup">Query string parameters</param> /// <param name="callback">Callback with the list of scheduled event users</param> /// <param name="error">Callback when an error occurs with error information</param> public static void GetUsers(DiscordClient client, Snowflake guildId, Snowflake eventId, ScheduledEventUsersLookup lookup = null, Action <List <ScheduledEventUser> > callback = null, Action <RestError> error = null) { if (!guildId.IsValid()) { throw new InvalidSnowflakeException(nameof(guildId)); } if (!eventId.IsValid()) { throw new InvalidSnowflakeException(nameof(eventId)); } if (lookup?.Limit != null && lookup.Limit.Value > 100) { throw new Exception($"{nameof(GuildScheduledEvent)}.{nameof(GetUsers)} Validation Error: {nameof(ScheduledEventUsersLookup)}.{nameof(ScheduledEventUsersLookup.Limit)} cannot be greater than 100"); } client.Bot.Rest.DoRequest($"/guilds/{guildId}/scheduled-events/{eventId}{lookup?.ToQueryString()}", RequestMethod.GET, null, callback, error); }