Add disabling reaction pings

This commit is contained in:
Lillian Berry
2020-03-21 08:04:41 -05:00
committed by Ske
parent 216dfffe58
commit 59af6f02e8
8 changed files with 45 additions and 9 deletions

View File

@@ -25,6 +25,7 @@ namespace PluralKit.Bot
public static Command SystemFrontHistory = new Command("system fronthistory", "system [system] fronthistory", "Shows a system's front history");
public static Command SystemFrontPercent = new Command("system frontpercent", "system [system] frontpercent [timespan]", "Shows a system's front breakdown");
public static Command SystemPrivacy = new Command("system privacy", "system privacy <description|members|fronter|fronthistory> <public|private>", "Changes your system's privacy settings");
public static Command SystemPing = new Command("system ping", "system ping <enable|disable>", "Changes your system's ping preferences");
public static Command Autoproxy = new Command("autoproxy", "autoproxy [off|front|latch|member]", "Sets your system's autoproxy mode for this server");
public static Command MemberInfo = new Command("member", "member <member>", "Looks up information about a member");
public static Command MemberNew = new Command("member new", "member new <name>", "Creates a new member");
@@ -204,6 +205,8 @@ namespace PluralKit.Bot
await ctx.Execute<SystemFront>(SystemFrontPercent, m => m.SystemFrontPercent(ctx, ctx.System));
else if (ctx.Match("privacy"))
await ctx.Execute<SystemEdit>(SystemPrivacy, m => m.SystemPrivacy(ctx));
else if (ctx.Match("ping"))
await ctx.Execute<SystemEdit>(SystemPing, m => m.SystemPing(ctx));
else if (ctx.Match("commands", "help"))
await PrintCommandList(ctx, "systems", SystemCommands);
else if (!ctx.HasNext()) // Bare command
@@ -365,4 +368,4 @@ namespace PluralKit.Bot
return $"System with ID `{input}` not found.";
}
}
}
}

View File

@@ -312,6 +312,29 @@ namespace PluralKit.Bot
await ctx.Reply($"System {subjectStr} privacy has been set to **{levelStr}**. Other accounts will now {levelExplanation} your system {subjectStr}.");
}
public async Task SystemPing(Context ctx)
{
ctx.CheckSystem();
if (!ctx.HasNext())
{
if (ctx.System.Pings) {await ctx.Reply("Reaction pings are currently **enabled** for your system. To disable reaction pings, type `pk;s ping disable`.");}
else {await ctx.Reply("Reaction pings are currently **disabled** for your system. To enable reaction pings, type `pk;s ping enable`.");}
}
else {
if (ctx.Match("on", "enable")) {
ctx.System.Pings = true;
await _data.SaveSystem(ctx.System);
await ctx.Reply("Reaction pings have now been enabled.");
}
if (ctx.Match("off", "disable")) {
ctx.System.Pings = false;
await _data.SaveSystem(ctx.System);
await ctx.Reply("Reaction pings have now been disabled.");
}
}
}
public async Task<DateTimeZone> FindTimeZone(Context ctx, string zoneStr) {
// First, if we're given a flag emoji, we extract the flag emoji code from it.
zoneStr = Core.StringUtils.ExtractCountryFlag(zoneStr) ?? zoneStr;
@@ -370,4 +393,4 @@ namespace PluralKit.Bot
});
}
}
}
}