From df4a978476b7fe2eaf642cf13c72d185178cab57 Mon Sep 17 00:00:00 2001 From: ashley zomo Date: Thu, 31 Mar 2022 15:34:29 -0500 Subject: [PATCH] oops --- commands.ts | 11 ----------- lang.ts | 51 --------------------------------------------------- main.ts | 40 ---------------------------------------- 3 files changed, 102 deletions(-) delete mode 100644 commands.ts delete mode 100644 lang.ts delete mode 100644 main.ts diff --git a/commands.ts b/commands.ts deleted file mode 100644 index 0b7d8ad..0000000 --- a/commands.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { CommandInteraction } from 'discord.js'; -import { getUser } from './util/discord'; -import Lang from 'lang/discord'; - -export async function PingCommand(interaction: CommandInteraction) { - const user = getUser(interaction); - interaction.reply(Lang.getEmbed('command.ping', { - username: user.username, - avatar: user.avatarURL() - })) -} \ No newline at end of file diff --git a/lang.ts b/lang.ts deleted file mode 100644 index cd03883..0000000 --- a/lang.ts +++ /dev/null @@ -1,51 +0,0 @@ -import Lang, { setLang } from "lang"; -import { setEmsgShim } from "discordslash"; - -export default function() { - - setLang({ - - main: { - login: 'Logged in as {user}' - }, - - command: { - - ping: { - embed: true, - title: 'Pong!', - description: [ - 'Woah!', - 'This descriptions has multiple lines' - ], - color: '#a0cc75', - timestamp: true, - footer: { - text: '{username}', - iconURL: '{avatar}' - } - }, - - pingDescription: 'Pong!' - - }, - - error: { - - main: { - missingToken: 'Missing Discord Token, please enter the bot token into the token file' - }, - - general: { - noUser: 'Unable to retrieve guild user information, please try again', - noMember: 'Unable to retrieve guild member information, please try again', - noChannel: 'Unable to retrieve text channel information, please try again' - } - - } - - }) - - setEmsgShim(Lang) - -} diff --git a/main.ts b/main.ts deleted file mode 100644 index dc26c0c..0000000 --- a/main.ts +++ /dev/null @@ -1,40 +0,0 @@ - -import { Client, Intents } from 'discord.js'; -import { addCommand, CommandGenerator, initClient } from 'discordslash'; -import Lang from 'lang'; -import { existsSync, readFileSync, writeFileSync } from 'fs'; -import { PingCommand } from './commands'; -import SetLang from './lang'; - -//init logs with a timestamp -console.log(new Date().toISOString()+'\n\n'); - -SetLang(); - -//get token -if (!existsSync('./token.txt')) { - writeFileSync('./token.txt', ''); - console.error(Lang.get('error.main.missingToken')); - process.exit(1); -} - -const TOKEN = readFileSync('./token.txt').toString(), - CLIENT = new Client({ intents: [Intents.FLAGS.GUILDS] }); - -initClient(CLIENT); - -addCommand([ - new CommandGenerator() - .setName('ping') - .setDescription(Lang.get('command.ping.description')) - .setRun(PingCommand) -]) - -//discord connections -CLIENT.on('ready', client => { - console.log(Lang.get('main.login', { - user: client.user.tag - })); -}); - -CLIENT.login(TOKEN);