Skip to content

Commit

Permalink
Add !on-call and !off-call
Browse files Browse the repository at this point in the history
Closes #232
  • Loading branch information
Erisa committed Oct 10, 2024
1 parent a48e5c4 commit fff0560
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Commands/TechSupportCommands.cs
Original file line number Diff line number Diff line change
@@ -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)
));
}
}
}

0 comments on commit fff0560

Please sign in to comment.