From fff056093f4df21c27a0e32578d11a14a965b339 Mon Sep 17 00:00:00 2001 From: Erisa A Date: Thu, 10 Oct 2024 21:48:50 +0100 Subject: [PATCH] Add !on-call and !off-call Closes #232 --- Commands/TechSupportCommands.cs | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Commands/TechSupportCommands.cs diff --git a/Commands/TechSupportCommands.cs b/Commands/TechSupportCommands.cs new file mode 100644 index 0000000..4310f92 --- /dev/null +++ b/Commands/TechSupportCommands.cs @@ -0,0 +1,35 @@ +namespace Cliptok.Commands +{ + internal class TechSupportCommands : BaseCommandModule + { + [Command("on-call")] + [Description("Give yourself the CTS role.")] + [RequireHomeserverPerm(ServerPermLevel.TechnicalQueriesSlayer)] + public async Task OnCallCommand(CommandContext ctx) + { + var ctsRole = await ctx.Guild.GetRoleAsync(Program.cfgjson.CommunityTechSupportRoleID); + await ctx.Member.GrantRoleAsync(ctsRole, "Used !on-call"); + await ctx.RespondAsync(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() + .WithTitle($"{Program.cfgjson.Emoji.On} Received Community Tech Support Role") + .WithDescription($"{ctx.User.Mention} is available to help out in **#tech-support**.") + .WithFooter("(Use `!off-call` when you're no longer available)") + .WithColor(DiscordColor.Green) + )); + } + + [Command("off-call")] + [Description("Remove the CTS role.")] + [RequireHomeserverPerm(ServerPermLevel.TechnicalQueriesSlayer)] + public async Task OffCallCommand(CommandContext ctx) + { + var ctsRole = await ctx.Guild.GetRoleAsync(Program.cfgjson.CommunityTechSupportRoleID); + await ctx.Member.RevokeRoleAsync(ctsRole, "Used !off-call"); + await ctx.RespondAsync(new DiscordMessageBuilder().AddEmbed(new DiscordEmbedBuilder() + .WithTitle($"{Program.cfgjson.Emoji.Off} Removed Community Tech Support Role") + .WithDescription($"{ctx.User.Mention} is no longer available to help out in **#tech-support**.") + .WithFooter("(Use `!on-call` again when you're available)") + .WithColor(DiscordColor.Red) + )); + } + } +}