Skip to content

Commit f63c63c

Browse files
Add missing [RemainingText] to text cmd parameters, fix bugs in kick
kick text cmd now deletes the invoking message and does not respond with "Done!"
1 parent 33741f7 commit f63c63c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Commands/BanCmds.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public async Task BanSlashCommand(SlashCommandContext ctx,
114114
[Description("Unbans a user who has been previously banned.")]
115115
[AllowedProcessors(typeof(SlashCommandProcessor), typeof(TextCommandProcessor))]
116116
[HomeServer, RequireHomeserverPerm(ServerPermLevel.Moderator), RequirePermissions(permissions: DiscordPermission.BanMembers)]
117-
public async Task UnbanCmd(CommandContext ctx, [Description("The user to unban, usually a mention or ID")] DiscordUser targetUser, [Description("Used in audit log only currently")] string reason = "No reason specified.")
117+
public async Task UnbanCmd(CommandContext ctx, [Description("The user to unban, usually a mention or ID")] DiscordUser targetUser, [RemainingText, Description("Used in audit log only currently")] string reason = "No reason specified.")
118118
{
119119
if ((await Program.db.HashExistsAsync("bans", targetUser.Id)))
120120
{

Commands/KickCmds.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ public class KickCmds
77
[Description("Kicks a user, removing them from the server until they rejoin.")]
88
[AllowedProcessors(typeof(SlashCommandProcessor), typeof(TextCommandProcessor))]
99
[RequireHomeserverPerm(ServerPermLevel.Moderator), RequirePermissions(DiscordPermission.KickMembers)]
10-
public async Task KickCmd(CommandContext ctx, [Parameter("user"), Description("The user you want to kick from the server.")] DiscordUser target, [Parameter("reason"), Description("The reason for kicking this user.")] string reason = "No reason specified.")
10+
public async Task KickCmd(CommandContext ctx, [Parameter("user"), Description("The user you want to kick from the server.")] DiscordUser target, [Parameter("reason"), Description("The reason for kicking this user."), RemainingText] string reason = "No reason specified.")
1111
{
1212
if (target.IsBot)
1313
{
1414
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} To prevent accidents, I won't kick bots. If you really need to do this, do it manually in Discord.");
1515
return;
1616
}
17+
18+
if (ctx is TextCommandContext)
19+
await ctx.As<TextCommandContext>().Message.DeleteAsync();
1720

1821
reason = reason.Replace("`", "\\`").Replace("*", "\\*");
1922

@@ -34,7 +37,8 @@ public class KickCmds
3437
{
3538
await KickAndLogAsync(member, reason, ctx.Member);
3639
await ctx.Channel.SendMessageAsync($"{Program.cfgjson.Emoji.Ejected} {target.Mention} has been kicked: **{reason}**");
37-
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Success} Done!", ephemeral: true);
40+
if (ctx is SlashCommandContext)
41+
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Success} Done!", ephemeral: true);
3842
return;
3943
}
4044
else

0 commit comments

Comments
 (0)