Skip to content

Commit

Permalink
Add Canary & Dev ('candev') to !announce
Browse files Browse the repository at this point in the history
  • Loading branch information
FloatingMilkshake committed Mar 21, 2024
1 parent 16dbab7 commit 8038bd9
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Commands/Announcements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public async Task EditAnnounce(
[Command("announce")]
[Description("Announces something in the current channel, pinging an Insider role in the process.")]
[HomeServer, RequireHomeserverPerm(ServerPermLevel.Moderator)]
public async Task AnnounceCmd(CommandContext ctx, [Description("'canary', 'dev','beta','rp', 'rp10, 'patch', 'rpbeta', 'betadev'")] string roleName, [RemainingText, Description("The announcement message to send.")] string announcementMessage)
public async Task AnnounceCmd(CommandContext ctx, [Description("'canary', 'dev','beta','rp', 'rp10, 'patch', 'rpbeta', 'betadev', 'candev'")] string roleName, [RemainingText, Description("The announcement message to send.")] string announcementMessage)
{
DiscordRole discordRole;

Expand Down Expand Up @@ -103,6 +103,27 @@ public async Task AnnounceCmd(CommandContext ctx, [Description("'canary', 'dev',
await betaRole.ModifyAsync(mentionable: false);
await devRole.ModifyAsync(mentionable: false);
}
else if (roleName == "candev")
{
var canaryRole = ctx.Guild.GetRole(Program.cfgjson.AnnouncementRoles["canary"]);
var devRole = ctx.Guild.GetRole(Program.cfgjson.AnnouncementRoles["dev"]);

await canaryRole.ModifyAsync(mentionable: true);
await devRole.ModifyAsync(mentionable: true);

try
{
await ctx.Message.DeleteAsync();
await ctx.Channel.SendMessageAsync($"{canaryRole.Mention} {devRole.Mention}\n{announcementMessage}");
}
catch
{
// We still need to remember to make it unmentionable even if the msg fails.
}

await canaryRole.ModifyAsync(mentionable: false);
await devRole.ModifyAsync(mentionable: false);
}
else
{
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} That role name isn't recognised!");
Expand Down

0 comments on commit 8038bd9

Please sign in to comment.