[Refactor] Remove some unnecessary async/await (#2739)
* Remove some unnecessary async/await * More not-so-async stuff * More not-so-async stuff * Fix merge issue
This commit is contained in:
@@ -437,12 +437,12 @@ namespace Discord.Interactions
|
||||
/// <returns>
|
||||
/// A task representing the command registration process. The task result contains the active application commands of the target guild.
|
||||
/// </returns>
|
||||
public async Task<IReadOnlyCollection<RestGuildCommand>> AddCommandsToGuildAsync(IGuild guild, bool deleteMissing = false, params ICommandInfo[] commands)
|
||||
public Task<IReadOnlyCollection<RestGuildCommand>> AddCommandsToGuildAsync(IGuild guild, bool deleteMissing = false, params ICommandInfo[] commands)
|
||||
{
|
||||
if (guild is null)
|
||||
throw new ArgumentNullException(nameof(guild));
|
||||
|
||||
return await AddCommandsToGuildAsync(guild.Id, deleteMissing, commands).ConfigureAwait(false);
|
||||
return AddCommandsToGuildAsync(guild.Id, deleteMissing, commands);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -498,12 +498,12 @@ namespace Discord.Interactions
|
||||
/// <returns>
|
||||
/// A task representing the command registration process. The task result contains the active application commands of the target guild.
|
||||
/// </returns>
|
||||
public async Task<IReadOnlyCollection<RestGuildCommand>> AddModulesToGuildAsync(IGuild guild, bool deleteMissing = false, params ModuleInfo[] modules)
|
||||
public Task<IReadOnlyCollection<RestGuildCommand>> AddModulesToGuildAsync(IGuild guild, bool deleteMissing = false, params ModuleInfo[] modules)
|
||||
{
|
||||
if (guild is null)
|
||||
throw new ArgumentNullException(nameof(guild));
|
||||
|
||||
return await AddModulesToGuildAsync(guild.Id, deleteMissing, modules).ConfigureAwait(false);
|
||||
return AddModulesToGuildAsync(guild.Id, deleteMissing, modules);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -692,12 +692,12 @@ namespace Discord.Interactions
|
||||
/// <returns>
|
||||
/// A task representing the command de-registration process. The task result contains the active application commands of the target guild.
|
||||
/// </returns>
|
||||
public async Task<IReadOnlyCollection<RestGuildCommand>> RemoveModulesFromGuildAsync(IGuild guild, params ModuleInfo[] modules)
|
||||
public Task<IReadOnlyCollection<RestGuildCommand>> RemoveModulesFromGuildAsync(IGuild guild, params ModuleInfo[] modules)
|
||||
{
|
||||
if (guild is null)
|
||||
throw new ArgumentNullException(nameof(guild));
|
||||
|
||||
return await RemoveModulesFromGuildAsync(guild.Id, modules).ConfigureAwait(false);
|
||||
return RemoveModulesFromGuildAsync(guild.Id, modules);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1164,7 +1164,7 @@ namespace Discord.Interactions
|
||||
/// <returns>
|
||||
/// The active command permissions after the modification.
|
||||
/// </returns>
|
||||
public async Task<GuildApplicationCommandPermission> ModifySlashCommandPermissionsAsync(ModuleInfo module, IGuild guild,
|
||||
public Task<GuildApplicationCommandPermission> ModifySlashCommandPermissionsAsync(ModuleInfo module, IGuild guild,
|
||||
params ApplicationCommandPermission[] permissions)
|
||||
{
|
||||
if (module is null)
|
||||
@@ -1173,7 +1173,7 @@ namespace Discord.Interactions
|
||||
if (guild is null)
|
||||
throw new ArgumentNullException(nameof(guild));
|
||||
|
||||
return await ModifySlashCommandPermissionsAsync(module, guild.Id, permissions).ConfigureAwait(false);
|
||||
return ModifySlashCommandPermissionsAsync(module, guild.Id, permissions);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1212,7 +1212,7 @@ namespace Discord.Interactions
|
||||
/// <returns>
|
||||
/// The active command permissions after the modification.
|
||||
/// </returns>
|
||||
public async Task<GuildApplicationCommandPermission> ModifySlashCommandPermissionsAsync(SlashCommandInfo command, IGuild guild,
|
||||
public Task<GuildApplicationCommandPermission> ModifySlashCommandPermissionsAsync(SlashCommandInfo command, IGuild guild,
|
||||
params ApplicationCommandPermission[] permissions)
|
||||
{
|
||||
if (command is null)
|
||||
@@ -1221,7 +1221,7 @@ namespace Discord.Interactions
|
||||
if (guild is null)
|
||||
throw new ArgumentNullException(nameof(guild));
|
||||
|
||||
return await ModifyApplicationCommandPermissionsAsync(command, guild.Id, permissions).ConfigureAwait(false);
|
||||
return ModifyApplicationCommandPermissionsAsync(command, guild.Id, permissions);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1233,8 +1233,9 @@ namespace Discord.Interactions
|
||||
/// <returns>
|
||||
/// The active command permissions after the modification.
|
||||
/// </returns>
|
||||
public async Task<GuildApplicationCommandPermission> ModifySlashCommandPermissionsAsync(SlashCommandInfo command, ulong guildId,
|
||||
params ApplicationCommandPermission[] permissions) => await ModifyApplicationCommandPermissionsAsync(command, guildId, permissions).ConfigureAwait(false);
|
||||
public Task<GuildApplicationCommandPermission> ModifySlashCommandPermissionsAsync(SlashCommandInfo command, ulong guildId,
|
||||
params ApplicationCommandPermission[] permissions)
|
||||
=> ModifyApplicationCommandPermissionsAsync(command, guildId, permissions);
|
||||
|
||||
/// <summary>
|
||||
/// Modify the command permissions of the matching Discord Slash Command.
|
||||
@@ -1245,7 +1246,7 @@ namespace Discord.Interactions
|
||||
/// <returns>
|
||||
/// The active command permissions after the modification.
|
||||
/// </returns>
|
||||
public async Task<GuildApplicationCommandPermission> ModifyContextCommandPermissionsAsync(ContextCommandInfo command, IGuild guild,
|
||||
public Task<GuildApplicationCommandPermission> ModifyContextCommandPermissionsAsync(ContextCommandInfo command, IGuild guild,
|
||||
params ApplicationCommandPermission[] permissions)
|
||||
{
|
||||
if (command is null)
|
||||
@@ -1254,7 +1255,7 @@ namespace Discord.Interactions
|
||||
if (guild is null)
|
||||
throw new ArgumentNullException(nameof(guild));
|
||||
|
||||
return await ModifyApplicationCommandPermissionsAsync(command, guild.Id, permissions).ConfigureAwait(false);
|
||||
return ModifyApplicationCommandPermissionsAsync(command, guild.Id, permissions);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1266,8 +1267,9 @@ namespace Discord.Interactions
|
||||
/// <returns>
|
||||
/// The active command permissions after the modification.
|
||||
/// </returns>
|
||||
public async Task<GuildApplicationCommandPermission> ModifyContextCommandPermissionsAsync(ContextCommandInfo command, ulong guildId,
|
||||
params ApplicationCommandPermission[] permissions) => await ModifyApplicationCommandPermissionsAsync(command, guildId, permissions).ConfigureAwait(false);
|
||||
public Task<GuildApplicationCommandPermission> ModifyContextCommandPermissionsAsync(ContextCommandInfo command, ulong guildId,
|
||||
params ApplicationCommandPermission[] permissions)
|
||||
=> ModifyApplicationCommandPermissionsAsync(command, guildId, permissions);
|
||||
|
||||
private async Task<GuildApplicationCommandPermission> ModifyApplicationCommandPermissionsAsync<T>(T command, ulong guildId,
|
||||
params ApplicationCommandPermission[] permissions) where T : class, IApplicationCommandInfo, ICommandInfo
|
||||
|
||||
Reference in New Issue
Block a user