forked from TeamInklings/Octobot
Bump Remora.Discord.Interactivity from 4.5.0 to 4.5.1 (#68)
Bumps Remora.Discord.Interactivity from 4.5.0 to 4.5.1. Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
f752ebf101
commit
abce09f26d
11 changed files with 38 additions and 40 deletions
|
@ -26,7 +26,7 @@
|
|||
<PackageReference Include="Remora.Discord.Caching" Version="37.0.0"/>
|
||||
<PackageReference Include="Remora.Discord.Extensions" Version="5.3.1"/>
|
||||
<PackageReference Include="Remora.Discord.Hosting" Version="6.0.7"/>
|
||||
<PackageReference Include="Remora.Discord.Interactivity" Version="4.5.0"/>
|
||||
<PackageReference Include="Remora.Discord.Interactivity" Version="4.5.1"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="locale\Messages.resx">
|
||||
|
|
|
@ -57,7 +57,7 @@ public class AboutCommandGroup : CommandGroup {
|
|||
if (!currentUserResult.IsDefined(out var currentUser))
|
||||
return Result.FromError(currentUserResult);
|
||||
|
||||
var cfg = await _dataService.GetSettings(guildId.Value, CancellationToken);
|
||||
var cfg = await _dataService.GetSettings(guildId, CancellationToken);
|
||||
Messages.Culture = GuildSettings.Language.Get(cfg);
|
||||
|
||||
return await SendAboutBotAsync(currentUser, CancellationToken);
|
||||
|
|
|
@ -77,10 +77,10 @@ public class BanCommandGroup : CommandGroup {
|
|||
var currentUserResult = await _userApi.GetCurrentUserAsync(CancellationToken);
|
||||
if (!currentUserResult.IsDefined(out var currentUser))
|
||||
return Result.FromError(currentUserResult);
|
||||
var userResult = await _userApi.GetUserAsync(userId.Value, CancellationToken);
|
||||
var userResult = await _userApi.GetUserAsync(userId, CancellationToken);
|
||||
if (!userResult.IsDefined(out var user))
|
||||
return Result.FromError(userResult);
|
||||
var guildResult = await _guildApi.GetGuildAsync(guildId.Value, ct: CancellationToken);
|
||||
var guildResult = await _guildApi.GetGuildAsync(guildId, ct: CancellationToken);
|
||||
if (!guildResult.IsDefined(out var guild))
|
||||
return Result.FromError(guildResult);
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class BanCommandGroup : CommandGroup {
|
|||
Messages.Culture = GuildSettings.Language.Get(data.Settings);
|
||||
|
||||
return await BanUserAsync(
|
||||
target, reason, duration, guild, data, channelId.Value, user, currentUser, CancellationToken);
|
||||
target, reason, duration, guild, data, channelId, user, currentUser, CancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Result> BanUserAsync(
|
||||
|
@ -193,15 +193,15 @@ public class BanCommandGroup : CommandGroup {
|
|||
if (!currentUserResult.IsDefined(out var currentUser))
|
||||
return Result.FromError(currentUserResult);
|
||||
// Needed to get the tag and avatar
|
||||
var userResult = await _userApi.GetUserAsync(userId.Value, CancellationToken);
|
||||
var userResult = await _userApi.GetUserAsync(userId, CancellationToken);
|
||||
if (!userResult.IsDefined(out var user))
|
||||
return Result.FromError(userResult);
|
||||
|
||||
var data = await _dataService.GetData(guildId.Value, CancellationToken);
|
||||
var data = await _dataService.GetData(guildId, CancellationToken);
|
||||
Messages.Culture = GuildSettings.Language.Get(data.Settings);
|
||||
|
||||
return await UnbanUserAsync(
|
||||
target, reason, guildId.Value, data, channelId.Value, user, currentUser, CancellationToken);
|
||||
target, reason, guildId, data, channelId, user, currentUser, CancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Result> UnbanUserAsync(
|
||||
|
|
|
@ -65,10 +65,10 @@ public class ClearCommandGroup : CommandGroup {
|
|||
new ArgumentNullError(nameof(_context), "Unable to retrieve necessary IDs from command context"));
|
||||
|
||||
var messagesResult = await _channelApi.GetChannelMessagesAsync(
|
||||
channelId.Value, limit: amount + 1, ct: CancellationToken);
|
||||
channelId, limit: amount + 1, ct: CancellationToken);
|
||||
if (!messagesResult.IsDefined(out var messages))
|
||||
return Result.FromError(messagesResult);
|
||||
var userResult = await _userApi.GetUserAsync(userId.Value, CancellationToken);
|
||||
var userResult = await _userApi.GetUserAsync(userId, CancellationToken);
|
||||
if (!userResult.IsDefined(out var user))
|
||||
return Result.FromError(userResult);
|
||||
// The current user's avatar is used when sending messages
|
||||
|
@ -76,10 +76,10 @@ public class ClearCommandGroup : CommandGroup {
|
|||
if (!currentUserResult.IsDefined(out var currentUser))
|
||||
return Result.FromError(currentUserResult);
|
||||
|
||||
var data = await _dataService.GetData(guildId.Value, CancellationToken);
|
||||
var data = await _dataService.GetData(guildId, CancellationToken);
|
||||
Messages.Culture = GuildSettings.Language.Get(data.Settings);
|
||||
|
||||
return await ClearMessagesAsync(amount, data, channelId.Value, messages, user, currentUser, CancellationToken);
|
||||
return await ClearMessagesAsync(amount, data, channelId, messages, user, currentUser, CancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Result> ClearMessagesAsync(
|
||||
|
|
|
@ -72,17 +72,17 @@ public class KickCommandGroup : CommandGroup {
|
|||
var currentUserResult = await _userApi.GetCurrentUserAsync(CancellationToken);
|
||||
if (!currentUserResult.IsDefined(out var currentUser))
|
||||
return Result.FromError(currentUserResult);
|
||||
var userResult = await _userApi.GetUserAsync(userId.Value, CancellationToken);
|
||||
var userResult = await _userApi.GetUserAsync(userId, CancellationToken);
|
||||
if (!userResult.IsDefined(out var user))
|
||||
return Result.FromError(userResult);
|
||||
var guildResult = await _guildApi.GetGuildAsync(guildId.Value, ct: CancellationToken);
|
||||
var guildResult = await _guildApi.GetGuildAsync(guildId, ct: CancellationToken);
|
||||
if (!guildResult.IsDefined(out var guild))
|
||||
return Result.FromError(guildResult);
|
||||
|
||||
var data = await _dataService.GetData(guildId.Value, CancellationToken);
|
||||
var data = await _dataService.GetData(guildId, CancellationToken);
|
||||
Messages.Culture = GuildSettings.Language.Get(data.Settings);
|
||||
|
||||
var memberResult = await _guildApi.GetGuildMemberAsync(guildId.Value, target.ID, CancellationToken);
|
||||
var memberResult = await _guildApi.GetGuildMemberAsync(guildId, target.ID, CancellationToken);
|
||||
if (!memberResult.IsSuccess) {
|
||||
var embed = new EmbedBuilder().WithSmallTitle(Messages.UserNotFoundShort, currentUser)
|
||||
.WithColour(ColorsList.Red).Build();
|
||||
|
@ -90,7 +90,7 @@ public class KickCommandGroup : CommandGroup {
|
|||
return await _feedbackService.SendContextualEmbedResultAsync(embed, CancellationToken);
|
||||
}
|
||||
|
||||
return await KickUserAsync(target, reason, guild, channelId.Value, data, user, currentUser, CancellationToken);
|
||||
return await KickUserAsync(target, reason, guild, channelId, data, user, currentUser, CancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Result> KickUserAsync(
|
||||
|
|
|
@ -76,14 +76,14 @@ public class MuteCommandGroup : CommandGroup {
|
|||
if (!currentUserResult.IsDefined(out var currentUser))
|
||||
return Result.FromError(currentUserResult);
|
||||
|
||||
var userResult = await _userApi.GetUserAsync(userId.Value, CancellationToken);
|
||||
var userResult = await _userApi.GetUserAsync(userId, CancellationToken);
|
||||
if (!userResult.IsDefined(out var user))
|
||||
return Result.FromError(userResult);
|
||||
|
||||
var data = await _dataService.GetData(guildId.Value, CancellationToken);
|
||||
var data = await _dataService.GetData(guildId, CancellationToken);
|
||||
Messages.Culture = GuildSettings.Language.Get(data.Settings);
|
||||
|
||||
var memberResult = await _guildApi.GetGuildMemberAsync(guildId.Value, target.ID, CancellationToken);
|
||||
var memberResult = await _guildApi.GetGuildMemberAsync(guildId, target.ID, CancellationToken);
|
||||
if (!memberResult.IsSuccess) {
|
||||
var embed = new EmbedBuilder().WithSmallTitle(Messages.UserNotFoundShort, currentUser)
|
||||
.WithColour(ColorsList.Red).Build();
|
||||
|
@ -92,7 +92,7 @@ public class MuteCommandGroup : CommandGroup {
|
|||
}
|
||||
|
||||
return await MuteUserAsync(
|
||||
target, reason, duration, guildId.Value, data, channelId.Value, user, currentUser, CancellationToken);
|
||||
target, reason, duration, guildId, data, channelId, user, currentUser, CancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Result> MuteUserAsync(
|
||||
|
@ -171,14 +171,14 @@ public class MuteCommandGroup : CommandGroup {
|
|||
return Result.FromError(currentUserResult);
|
||||
|
||||
// Needed to get the tag and avatar
|
||||
var userResult = await _userApi.GetUserAsync(userId.Value, CancellationToken);
|
||||
var userResult = await _userApi.GetUserAsync(userId, CancellationToken);
|
||||
if (!userResult.IsDefined(out var user))
|
||||
return Result.FromError(userResult);
|
||||
|
||||
var data = await _dataService.GetData(guildId.Value, CancellationToken);
|
||||
var data = await _dataService.GetData(guildId, CancellationToken);
|
||||
Messages.Culture = GuildSettings.Language.Get(data.Settings);
|
||||
|
||||
var memberResult = await _guildApi.GetGuildMemberAsync(guildId.Value, target.ID, CancellationToken);
|
||||
var memberResult = await _guildApi.GetGuildMemberAsync(guildId, target.ID, CancellationToken);
|
||||
if (!memberResult.IsSuccess) {
|
||||
var embed = new EmbedBuilder().WithSmallTitle(Messages.UserNotFoundShort, currentUser)
|
||||
.WithColour(ColorsList.Red).Build();
|
||||
|
@ -187,7 +187,7 @@ public class MuteCommandGroup : CommandGroup {
|
|||
}
|
||||
|
||||
return await UnmuteUserAsync(
|
||||
target, reason, guildId.Value, data, channelId.Value, user, currentUser, CancellationToken);
|
||||
target, reason, guildId, data, channelId, user, currentUser, CancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Result> UnmuteUserAsync(
|
||||
|
|
|
@ -60,10 +60,10 @@ public class PingCommandGroup : CommandGroup {
|
|||
if (!currentUserResult.IsDefined(out var currentUser))
|
||||
return Result.FromError(currentUserResult);
|
||||
|
||||
var cfg = await _dataService.GetSettings(guildId.Value, CancellationToken);
|
||||
var cfg = await _dataService.GetSettings(guildId, CancellationToken);
|
||||
Messages.Culture = GuildSettings.Language.Get(cfg);
|
||||
|
||||
return await SendLatencyAsync(channelId.Value, currentUser, CancellationToken);
|
||||
return await SendLatencyAsync(channelId, currentUser, CancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Result> SendLatencyAsync(
|
||||
|
|
|
@ -55,14 +55,14 @@ public class RemindCommandGroup : CommandGroup {
|
|||
return Result.FromError(
|
||||
new ArgumentNullError(nameof(_context), "Unable to retrieve necessary IDs from command context"));
|
||||
|
||||
var userResult = await _userApi.GetUserAsync(userId.Value, CancellationToken);
|
||||
var userResult = await _userApi.GetUserAsync(userId, CancellationToken);
|
||||
if (!userResult.IsDefined(out var user))
|
||||
return Result.FromError(userResult);
|
||||
|
||||
var data = await _dataService.GetData(guildId.Value, CancellationToken);
|
||||
var data = await _dataService.GetData(guildId, CancellationToken);
|
||||
Messages.Culture = GuildSettings.Language.Get(data.Settings);
|
||||
|
||||
return await AddReminderAsync(@in, message, data, channelId.Value, user, CancellationToken);
|
||||
return await AddReminderAsync(@in, message, data, channelId, user, CancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Result> AddReminderAsync(
|
||||
|
|
|
@ -76,7 +76,7 @@ public class SettingsCommandGroup : CommandGroup {
|
|||
if (!currentUserResult.IsDefined(out var currentUser))
|
||||
return Result.FromError(currentUserResult);
|
||||
|
||||
var cfg = await _dataService.GetSettings(guildId.Value, CancellationToken);
|
||||
var cfg = await _dataService.GetSettings(guildId, CancellationToken);
|
||||
Messages.Culture = GuildSettings.Language.Get(cfg);
|
||||
|
||||
return await SendSettingsListAsync(cfg, currentUser, CancellationToken);
|
||||
|
@ -124,7 +124,7 @@ public class SettingsCommandGroup : CommandGroup {
|
|||
if (!currentUserResult.IsDefined(out var currentUser))
|
||||
return Result.FromError(currentUserResult);
|
||||
|
||||
var data = await _dataService.GetData(guildId.Value, CancellationToken);
|
||||
var data = await _dataService.GetData(guildId, CancellationToken);
|
||||
Messages.Culture = GuildSettings.Language.Get(data.Settings);
|
||||
|
||||
return await EditSettingAsync(setting, value, data, currentUser, CancellationToken);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using DiffPlex.DiffBuilder.Model;
|
||||
|
@ -182,11 +181,10 @@ public static class Extensions {
|
|||
}
|
||||
|
||||
public static bool TryGetContextIDs(
|
||||
this ICommandContext context, [NotNullWhen(true)] out Snowflake? guildId,
|
||||
[NotNullWhen(true)] out Snowflake? channelId, [NotNullWhen(true)] out Snowflake? userId) {
|
||||
guildId = null;
|
||||
channelId = null;
|
||||
userId = null;
|
||||
this ICommandContext context, out Snowflake guildId,
|
||||
out Snowflake channelId, out Snowflake userId) {
|
||||
channelId = default;
|
||||
userId = default;
|
||||
return context.TryGetGuildID(out guildId)
|
||||
&& context.TryGetChannelID(out channelId)
|
||||
&& context.TryGetUserID(out userId);
|
||||
|
|
|
@ -185,12 +185,12 @@ public class UtilityService : IHostedService {
|
|||
var builtArray = new[] { logBuilt };
|
||||
|
||||
// Not awaiting to reduce response time
|
||||
if (isPublic && publicChannel != channelId.Value)
|
||||
if (isPublic && publicChannel != channelId)
|
||||
_ = _channelApi.CreateMessageAsync(
|
||||
publicChannel, embeds: builtArray,
|
||||
ct: ct);
|
||||
if (privateChannel != publicChannel
|
||||
&& privateChannel != channelId.Value)
|
||||
&& privateChannel != channelId)
|
||||
_ = _channelApi.CreateMessageAsync(
|
||||
privateChannel, embeds: builtArray,
|
||||
ct: ct);
|
||||
|
|
Reference in a new issue