Skip to content
This repository was archived by the owner on Nov 24, 2022. It is now read-only.

Commit 84cbed8

Browse files
committed
Fix delete slash command
1 parent b87c58f commit 84cbed8

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

TabletBot.Discord/SlashCommands/ModerationSlashCommands.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ namespace TabletBot.Discord.SlashCommands
1010
{
1111
public class ModerationSlashCommands : SlashCommandModule
1212
{
13-
protected const string DELETE = "delete";
14-
protected const string KICK_USER = "kick";
15-
protected const string BAN_USER = "ban";
16-
protected const string CREATE_EMBED = "embed";
13+
private const string DELETE = "delete";
14+
private const string KICK_USER = "kick";
15+
private const string BAN_USER = "ban";
16+
private const string CREATE_EMBED = "embed";
1717

1818
protected override IEnumerable<SlashCommand> GetSlashCommands()
1919
{
@@ -165,7 +165,7 @@ protected override IEnumerable<SlashCommand> GetSlashCommands()
165165

166166
private async Task Delete(SocketSlashCommand command)
167167
{
168-
var amount = command.GetValue<int>("amount", 1);
168+
var amount = (int)command.GetValue<long>("amount", 1);
169169

170170
var messages = await command.Channel.GetMessagesAsync(amount).FlattenAsync();
171171
await (command.Channel as ITextChannel).DeleteMessagesAsync(messages);

TabletBot.Discord/Watchers/Commands/CommandMessageWatcher.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Discord.Commands;
66
using Discord.WebSocket;
77
using TabletBot.Common;
8+
using TabletBot.Discord.Commands;
89

910
namespace TabletBot.Discord.Watchers.Commands
1011
{
@@ -28,7 +29,7 @@ IEnumerable<Type> commands
2829
_serviceProvider = serviceProvider;
2930
_discordClient = discordClient;
3031
_commandService = commandService;
31-
_commands = commands;
32+
_commands = commands.OfType<ModuleBase<ICommandContext>>();
3233
}
3334

3435
private bool _registered;

0 commit comments

Comments
 (0)