feat: throw exception

This commit is contained in:
spiral 2021-10-30 18:49:36 -04:00
parent f44f83c809
commit d9da50c189
No known key found for this signature in database
GPG Key ID: A6059F0CA0E1BD31
2 changed files with 21 additions and 0 deletions

View File

@ -205,6 +205,7 @@ namespace PluralKit.Bot
if (ctx.Match("freeze")) return ctx.Execute<Fun>(null, m => m.Freeze(ctx)); if (ctx.Match("freeze")) return ctx.Execute<Fun>(null, m => m.Freeze(ctx));
if (ctx.Match("starstorm")) return ctx.Execute<Fun>(null, m => m.Starstorm(ctx)); if (ctx.Match("starstorm")) return ctx.Execute<Fun>(null, m => m.Starstorm(ctx));
if (ctx.Match("flash")) return ctx.Execute<Fun>(null, m => m.Flash(ctx)); if (ctx.Match("flash")) return ctx.Execute<Fun>(null, m => m.Flash(ctx));
if (ctx.Match("error")) return ctx.Execute<Fun>(null, m => m.Error(ctx));
if (ctx.Match("stats")) return ctx.Execute<Misc>(null, m => m.Stats(ctx)); if (ctx.Match("stats")) return ctx.Execute<Misc>(null, m => m.Stats(ctx));
if (ctx.Match("permcheck")) if (ctx.Match("permcheck"))
return ctx.Execute<Checks>(PermCheck, m => m.PermCheckGuild(ctx)); return ctx.Execute<Checks>(PermCheck, m => m.PermCheckGuild(ctx));

View File

@ -1,5 +1,11 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Myriad.Builders;
using NodaTime;
using PluralKit.Core;
namespace PluralKit.Bot namespace PluralKit.Bot
{ {
public class Fun 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 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 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 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 <https://pluralkit.me/commands>.");
}
} }
} }