From 7e7167796f6618ab14c78ef2d3a348fcab3ecfd7 Mon Sep 17 00:00:00 2001 From: Vylpes Date: Tue, 9 Aug 2022 12:32:03 +0100 Subject: [PATCH] Add say command (#174) Co-authored-by: Ethan Lane Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/vylbot-app/pulls/174 --- .env.template | 4 ++-- src/commands/say.ts | 26 ++++++++++++++++++++++++++ src/registry.ts | 2 ++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 src/commands/say.ts diff --git a/.env.template b/.env.template index ab57e01..88ad8df 100644 --- a/.env.template +++ b/.env.template @@ -7,7 +7,7 @@ # any secret values. BOT_TOKEN= -BOT_VER=3.0.4 +BOT_VER=3.1 BOT_AUTHOR=Vylpes -BOT_DATE=06 Jul 2022 +BOT_DATE=08 Aug 2022 BOT_OWNERID=147392775707426816 diff --git a/src/commands/say.ts b/src/commands/say.ts new file mode 100644 index 0000000..433b2b8 --- /dev/null +++ b/src/commands/say.ts @@ -0,0 +1,26 @@ +import { ICommandContext } from "../contracts/ICommandContext"; +import ErrorEmbed from "../helpers/embeds/ErrorEmbed"; +import { Command } from "../type/command"; + +export default class Say extends Command { + constructor() { + super(); + super.Category = "Misc"; + super.Roles = [ + "moderator" + ]; + } + + public override async execute(context: ICommandContext) { + const input = context.args.join(" "); + + if (input.length == 0) { + const errorEmbed = new ErrorEmbed(context, "You must supply a message."); + + await errorEmbed.SendToCurrentChannel(); + return; + } + + context.message.channel.send(input); + } +} \ No newline at end of file diff --git a/src/registry.ts b/src/registry.ts index 183bac2..4fa68f7 100644 --- a/src/registry.ts +++ b/src/registry.ts @@ -14,6 +14,7 @@ import Mute from "./commands/mute"; import Poll from "./commands/poll"; import Role from "./commands/role"; import Rules from "./commands/rules"; +import Say from "./commands/say"; import Setup from "./commands/setup"; import Unmute from "./commands/unmute"; import Warn from "./commands/warn"; @@ -46,6 +47,7 @@ export default class Registry { CoreClient.RegisterCommand("unmute", new Unmute()); CoreClient.RegisterCommand("warn", new Warn()); CoreClient.RegisterCommand("setup", new Setup()); + CoreClient.RegisterCommand("say", new Say()); // Exclusive Commands: MankBot CoreClient.RegisterCommand("lobby", new Lobby(), "501231711271780357");