feat(bot): server config toggle for @silent proxied messages

This commit is contained in:
Iris System 2024-12-30 04:33:17 +00:00
parent 2d36b8a7cc
commit b88c1b7712
12 changed files with 50 additions and 3 deletions

View file

@ -49,6 +49,13 @@ public class ServerConfig
"disabled"
));
items.Add(new(
"suppress notifications",
"Whether all proxied messages will have notifications suppressed (sent as `@silent` messages)",
EnabledDisabled(ctx.GuildConfig!.SuppressNotifications),
"disabled"
));
items.Add(new(
"log channel",
"Channel to log proxied messages to",
@ -426,4 +433,20 @@ public class ServerConfig
await ctx.Repository.UpdateGuild(ctx.Guild.Id, new() { RequireSystemTag = newVal });
await ctx.Reply($"System tags are now **{(newVal ? "required" : "not required")}** for PluralKit users in this server.");
}
public async Task SuppressNotifications(Context ctx)
{
await ctx.CheckGuildContext().CheckAuthorPermission(PermissionSet.ManageGuild, "Manage Server");
if (!ctx.HasNext())
{
var msg = $"Suppressing notifications for proxied messages is currently **{EnabledDisabled(ctx.GuildConfig!.SuppressNotifications)}**.";
await ctx.Reply(msg);
return;
}
var newVal = ctx.MatchToggle(false);
await ctx.Repository.UpdateGuild(ctx.Guild.Id, new() { SuppressNotifications = newVal });
await ctx.Reply($"Suppressing notifications for proxied messages is now {EnabledDisabled(newVal)}.");
}
}