public static Task <RoleJsonModel> ModifyRoleAsync(this IRestApiClient client, Snowflake guildId, Snowflake roleId, ModifyRoleJsonRestRequestContent content, IRestRequestOptions options = null) { var route = Format(Route.Guild.ModifyRole, guildId, roleId); return(client.ExecuteAsync <RoleJsonModel>(route, content, options)); }
public Task DeleteResponseAsync(IRestRequestOptions options = null) { var client = Interaction.GetRestClient(); return(client.DeleteInteractionResponseAsync(Interaction.ApplicationId, Interaction.Token, options)); }
public Task <IUserMessage> FetchAsync(Snowflake followupId, IRestRequestOptions options = null) { var client = Interaction.GetRestClient(); return(client.FetchInteractionFollowupAsync(Interaction.ApplicationId, Interaction.Token, followupId, options)); }
public static Task <ThreadListJsonModel> FetchJoinedPrivateArchivedThreadsAsync(this IRestApiClient client, Snowflake channelId, int limit = Discord.Limits.Rest.FetchThreadsPageSize, Snowflake?startFromId = null, IRestRequestOptions options = null, CancellationToken cancellationToken = default) { Guard.IsBetweenOrEqualTo(limit, 0, Discord.Limits.Rest.FetchThreadsPageSize); var queryParameters = new Dictionary <string, object> { ["limit"] = limit }; if (startFromId != null) { queryParameters["before"] = startFromId.Value; } var route = Format(Route.Channel.ListJoinedPrivateArchivedThreads, queryParameters, channelId); return(client.ExecuteAsync <ThreadListJsonModel>(route, null, options, cancellationToken)); }
public Task <IUserMessage> FetchResponseAsync(IRestRequestOptions options = null) { var client = Interaction.GetRestClient(); return(client.FetchInteractionResponseAsync(Interaction.ApplicationId, Interaction.Token, options)); }
public static Task <MemberJsonModel[]> FetchMembersAsync(this IRestApiClient client, Snowflake guildId, int limit = 1000, Snowflake?startFromId = null, IRestRequestOptions options = null) { if (limit < 1 || limit > 1000) { throw new ArgumentOutOfRangeException(nameof(limit)); } var queryParameters = new Dictionary <string, object>(startFromId != null ? 2 : 1) { ["limit"] = limit }; if (startFromId != null) { queryParameters["after"] = startFromId; } var route = Format(Route.Guild.GetMembers, queryParameters, guildId); return(client.ExecuteAsync <MemberJsonModel[]>(route, null, options)); }
public FetchJoinedPrivateArchivedThreadsPagedEnumerator(IRestClient client, Snowflake channelId, int limit, Snowflake?startFromId, IRestRequestOptions options = null) : base(client, limit, options) { _channelId = channelId; _startFromId = startFromId; }
public static Task <WelcomeScreenJsonModel> ModifyGuildWelcomeScreenAsync(this IRestApiClient client, Snowflake guildId, ModifyWelcomeScreenJsonRestRequestContent content, IRestRequestOptions options = null) { var route = Format(Route.Guild.ModifyWelcomeScreen, guildId); return(client.ExecuteAsync <WelcomeScreenJsonModel>(route, content, options)); }
public static Task <GuildWidgetJsonModel> FetchGuildWidgetAsync(this IRestApiClient client, Snowflake guildId, IRestRequestOptions options = null) { var route = Format(Route.Guild.GetWidgetSettings, guildId); return(client.ExecuteAsync <GuildWidgetJsonModel>(route, null, options)); }
public static Task SyncIntegrationAsync(this IRestApiClient client, Snowflake guildId, Snowflake integrationId, IRestRequestOptions options = null) { var route = Format(Route.Guild.SyncIntegration, guildId, integrationId); return(client.ExecuteAsync(route, null, options)); }
public static Task <WelcomeScreenJsonModel> FetchGuildWelcomeScreenAsync(this IRestApiClient client, Snowflake guildId, IRestRequestOptions options = null) { var route = Format(Route.Guild.GetWelcomeScreen, guildId); return(client.ExecuteAsync <WelcomeScreenJsonModel>(route, null, options)); }
public static Task ModifyIntegrationAsync(this IRestApiClient client, Snowflake guildId, Snowflake integrationId, ModifyGuildIntegrationJsonRestRequestContent content, IRestRequestOptions options = null) { var route = Format(Route.Guild.ModifyIntegration, guildId, integrationId); return(client.ExecuteAsync(route, content, options)); }
public static Task <PruneJsonModel> PruneGuildAsync(this IRestApiClient client, Snowflake guildId, int days = 7, bool computePruneCount = false, Snowflake[] roleIds = null, IRestRequestOptions options = null) { var queryParameters = new Dictionary <string, object>(roleIds != null ? 3 : 2) { ["days"] = days, ["compute_prune_count"] = computePruneCount }; if (roleIds != null) { queryParameters["include_roles"] = roleIds; } var route = Format(Route.Guild.BeginPrune, queryParameters, guildId); return(client.ExecuteAsync <PruneJsonModel>(route, null, options)); }
public static Task <PruneJsonModel> FetchPruneGuildCountAsync(this IRestApiClient client, Snowflake guildId, int days = 7, Snowflake[] roleIds = null, IRestRequestOptions options = null) { var queryParameters = new Dictionary <string, object>(roleIds != null ? 2 : 1) { ["days"] = days }; if (roleIds != null) { queryParameters["include_roles"] = roleIds; } var route = Format(Route.Guild.GetPruneCount, queryParameters, guildId); return(client.ExecuteAsync <PruneJsonModel>(route, null, options)); }
public static Task <ThreadListJsonModel> FetchActiveThreadsAsync(this IRestApiClient client, Snowflake guildId, IRestRequestOptions options = null) { var route = Format(Route.Guild.ListActiveThreads, guildId); return(client.ExecuteAsync <ThreadListJsonModel>(route, null, options)); }
public static Task <GuildWidgetJsonModel> ModifyGuildWidgetAsync(this IRestApiClient client, Snowflake guildId, ModifyGuildWidgetSettingsJsonRestRequestContent content, IRestRequestOptions options = null) { var route = Format(Route.Guild.ModifyWidget, guildId); return(client.ExecuteAsync <GuildWidgetJsonModel>(route, content, options)); }
public static Task <MemberJsonModel> FetchMemberAsync(this IRestApiClient client, Snowflake guildId, Snowflake memberId, IRestRequestOptions options = null) { var route = Format(Route.Guild.GetMember, guildId, memberId); return(client.ExecuteAsync <MemberJsonModel>(route, null, options)); }
public static Task <InviteJsonModel> FetchGuildVanityInviteAsync(this IRestApiClient client, Snowflake guildId, IRestRequestOptions options = null) { var route = Format(Route.Guild.GetVanityUrl, guildId); return(client.ExecuteAsync <InviteJsonModel>(route, null, options)); }
public static Task <GuildJsonModel> CreateGuildAsync(this IRestApiClient client, CreateGuildJsonRestRequestContent content, IRestRequestOptions options = null) { var route = Format(Route.Guild.CreateGuild); return(client.ExecuteAsync <GuildJsonModel>(route, content, options)); }
public static Task ModifyMemberVoiceStateAsync(this IRestApiClient client, Snowflake guildId, Snowflake memberId, ModifyMemberVoiceStateJsonRestRequestContent content, IRestRequestOptions options = null) { var route = Format(Route.Guild.ModifyMemberVoiceState, guildId, memberId); return(client.ExecuteAsync(route, content, options)); }
protected override async Task <IReadOnlyList <IThreadChannel> > NextPageAsync(IReadOnlyList <IThreadChannel> previousPage, IRestRequestOptions options = null) { var startFromId = _startFromId; if (previousPage != null && previousPage.Count > 0) { startFromId = previousPage[^ 1].Id;
public static Task DeleteGuildAsync(this IRestApiClient client, Snowflake guildId, IRestRequestOptions options = null) { var route = Format(Route.Guild.DeleteGuild, guildId); return(client.ExecuteAsync(route, null, options)); }
/// <summary> /// Instantiates a new <see cref="TypingRepeater"/>. /// </summary> /// <param name="client"> The client to execute the requests with. </param> /// <param name="channelId"> The ID of the channel to trigger typing in. </param> /// <param name="options"> The request options. </param> /// <param name="cancellationToken"> The cancellation token to observe. </param> public TypingRepeater(IRestClient client, Snowflake channelId, IRestRequestOptions options = null, CancellationToken cancellationToken = default) : base(client, options, cancellationToken) { ChannelId = channelId; }
public static Task <ChannelJsonModel[]> FetchGuildChannelsAsync(this IRestApiClient client, Snowflake guildId, IRestRequestOptions options = null) { var route = Format(Route.Guild.GetChannels, guildId); return(client.ExecuteAsync <ChannelJsonModel[]>(route, null, options)); }
public Task <IUserMessage> ModifyResponseAsync(Action <ModifyWebhookMessageActionProperties> action, IRestRequestOptions options = null) { var client = Interaction.GetRestClient(); return(client.ModifyInteractionResponseAsync(Interaction.ApplicationId, Interaction.Token, action, options)); }
public static Task <ChannelJsonModel> CreateGuildChannelAsync(this IRestApiClient client, Snowflake guildId, CreateGuildChannelJsonRestRequestContent content, IRestRequestOptions options = null) { var route = Format(Route.Guild.CreateChannel, guildId); return(client.ExecuteAsync <ChannelJsonModel>(route, content, options)); }
public Task <IUserMessage> SendAsync(LocalInteractionFollowup followup, IRestRequestOptions options = null) { var client = Interaction.GetRestClient(); return(client.CreateInteractionFollowupAsync(Interaction.ApplicationId, Interaction.Token, followup, options)); }
public static Task ReorderGuildChannelsAsync(this IRestApiClient client, Snowflake guildId, JsonObjectRestRequestContent <ReorderJsonRestRequestContent[]> content, IRestRequestOptions options = null) { var route = Format(Route.Guild.ReorderChannels, guildId); return(client.ExecuteAsync(route, content, options)); }
public Task <IUserMessage> ModifyAsync(Snowflake followupId, Action <ModifyWebhookMessageActionProperties> action, IRestRequestOptions options = null) { var client = Interaction.GetRestClient(); return(client.ModifyInteractionFollowupAsync(Interaction.ApplicationId, Interaction.Token, followupId, action, options)); }
public static Task CreateBanAsync(this IRestApiClient client, Snowflake guildId, Snowflake userId, CreateBanJsonRestRequestContent content, IRestRequestOptions options = null) { var route = Format(Route.Guild.CreateBan, guildId, userId); return(client.ExecuteAsync(route, content, options)); }