From a4d08f069660a1691741c7126891c173c16154e6 Mon Sep 17 00:00:00 2001 From: Hexugory Date: Tue, 28 Mar 2023 23:28:37 -0500 Subject: [PATCH] it runs now --- package.json | 4 ++-- src/cb.ts | 13 +++++++++++++ src/cbclient.ts | 5 +++++ src/commands/commandlist.ts | 3 ++- src/mud.ts | 0 src/slash/commandlist.ts | 6 ++++-- src/slash/randomcase.ts | 33 +++++++++++++++++++++++++++++++++ 7 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 src/cb.ts create mode 100644 src/cbclient.ts delete mode 100644 src/mud.ts create mode 100644 src/slash/randomcase.ts diff --git a/package.json b/package.json index 561636a..c8783d7 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,10 @@ "name": "2023collectabot", "version": "1.0.0", "description": "stupid", - "main": "out/mud.js", + "main": "out/cb.js", "scripts": { "build": "tsc", - "start": "node ./out/mud.js" + "start": "node ./out/cb.js" }, "author": "Collectabot Team", "license": "MIT", diff --git a/src/cb.ts b/src/cb.ts new file mode 100644 index 0000000..0705707 --- /dev/null +++ b/src/cb.ts @@ -0,0 +1,13 @@ +import { GatewayIntentBits, Partials } from "discord.js"; +import { CBClient } from "./cbclient"; +import { db } from "./database"; + +const Client = new CBClient({ + intents: [ + GatewayIntentBits.MessageContent, + GatewayIntentBits.Guilds, + GatewayIntentBits.GuildMessages, + GatewayIntentBits.DirectMessages + ], + partials: [Partials.Channel] +}, db); \ No newline at end of file diff --git a/src/cbclient.ts b/src/cbclient.ts new file mode 100644 index 0000000..a845231 --- /dev/null +++ b/src/cbclient.ts @@ -0,0 +1,5 @@ +import { CommandClient } from "./commandclient"; + +export class CBClient extends CommandClient { + +} \ No newline at end of file diff --git a/src/commands/commandlist.ts b/src/commands/commandlist.ts index e06b6da..ef5d490 100644 --- a/src/commands/commandlist.ts +++ b/src/commands/commandlist.ts @@ -1,10 +1,11 @@ import { BlacklistCommand } from "./blacklist"; +import { Command } from "./command"; import { DeploySlashCommand } from "./deployslash"; import { GlobalBlacklistCommand } from "./gblacklist"; import { KillCommand } from "./kill"; import { RandomCaseCommand } from "./randomcase"; -export const CommandList = [ +export const CommandList: Command[] = [ new GlobalBlacklistCommand(), new BlacklistCommand(), new RandomCaseCommand(), diff --git a/src/mud.ts b/src/mud.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/slash/commandlist.ts b/src/slash/commandlist.ts index 4252b54..ebba093 100644 --- a/src/slash/commandlist.ts +++ b/src/slash/commandlist.ts @@ -1,4 +1,6 @@ +import { RandomCaseCommand } from "./randomcase"; +import { SlashCommand } from "./slash"; -export const SlashCommandList = [ - //new Command() +export const SlashCommandList: SlashCommand[] = [ + new RandomCaseCommand() ]; \ No newline at end of file diff --git a/src/slash/randomcase.ts b/src/slash/randomcase.ts new file mode 100644 index 0000000..5e2327e --- /dev/null +++ b/src/slash/randomcase.ts @@ -0,0 +1,33 @@ +import { ApplicationCommandOptionData, ApplicationCommandOptionType, CommandInteraction } from "discord.js" +import { createArgumentsObject, SlashCommand } from "./slash" + +interface RandomCaseArguments { + string: string +} + +export class RandomCaseCommand implements SlashCommand { + name = 'randomcase' + description = 'dOEs thIs' + permission = [] + ownerOnly = false + guildOnly = false + args: ApplicationCommandOptionData[] = [ + { + name: 'string', + type: ApplicationCommandOptionType.String, + description: 'some words', + required: true + } + ] + + async execute(int: CommandInteraction) { + const args = createArgumentsObject(int.options.data) as RandomCaseArguments; + + var strSplit = args.string.toLowerCase().split(''); + for(let [i, char] of strSplit.entries()){ + if (Math.random() > 0.5) strSplit[i] = char.toUpperCase(); + } + int.reply(strSplit.join('')); + return; + } +};