From d9da50c1891574d16496bcc003dc8ee294f5199d Mon Sep 17 00:00:00 2001 From: spiral Date: Sat, 30 Oct 2021 18:49:36 -0400 Subject: [PATCH] feat: throw exception --- PluralKit.Bot/Commands/CommandTree.cs | 1 + PluralKit.Bot/Commands/Fun.cs | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/PluralKit.Bot/Commands/CommandTree.cs b/PluralKit.Bot/Commands/CommandTree.cs index 5c016def..de4b41e0 100644 --- a/PluralKit.Bot/Commands/CommandTree.cs +++ b/PluralKit.Bot/Commands/CommandTree.cs @@ -205,6 +205,7 @@ namespace PluralKit.Bot if (ctx.Match("freeze")) return ctx.Execute(null, m => m.Freeze(ctx)); if (ctx.Match("starstorm")) return ctx.Execute(null, m => m.Starstorm(ctx)); if (ctx.Match("flash")) return ctx.Execute(null, m => m.Flash(ctx)); + if (ctx.Match("error")) return ctx.Execute(null, m => m.Error(ctx)); if (ctx.Match("stats")) return ctx.Execute(null, m => m.Stats(ctx)); if (ctx.Match("permcheck")) return ctx.Execute(PermCheck, m => m.PermCheckGuild(ctx)); diff --git a/PluralKit.Bot/Commands/Fun.cs b/PluralKit.Bot/Commands/Fun.cs index 70f144ff..a6c1eb88 100644 --- a/PluralKit.Bot/Commands/Fun.cs +++ b/PluralKit.Bot/Commands/Fun.cs @@ -1,5 +1,11 @@ using System.Threading.Tasks; +using Myriad.Builders; + +using NodaTime; + +using PluralKit.Core; + namespace PluralKit.Bot { public class Fun @@ -10,5 +16,19 @@ namespace PluralKit.Bot public Task Freeze(Context ctx) => ctx.Reply("*A giant crystal ball of ice is charged and hurled toward your opponent, bursting open and freezing them solid on contact.*"); public Task Starstorm(Context ctx) => ctx.Reply("*Vibrant colours burst forth from the sky as meteors rain down upon your opponent.*"); public Task Flash(Context ctx) => ctx.Reply("*A ball of green light appears above your head and flies towards your enemy, exploding on contact.*"); + public Task Error(Context ctx) + { + if (ctx.Match("message")) + return ctx.Reply($"> **Error code:** `50f3c7b439d111ecab2023a5431fffbd`", embed: new EmbedBuilder() + .Color(0xE74C3C) + .Title("Internal error occurred") + .Description("For support, please send the error code above in **#bug-reports-and-errors** on **[the support server *(click to join)*](https://discord.gg/PczBt78)** with a description of what you were doing at the time.") + .Footer(new("50f3c7b439d111ecab2023a5431fffbd")) + .Timestamp(SystemClock.Instance.GetCurrentInstant().ToDateTimeOffset().ToString("O")) + .Build() + ); + + return ctx.Reply($"{Emojis.Error} Unknown command {"error".AsCode()}. For a list of possible commands, see ."); + } } } \ No newline at end of file