oops
This commit is contained in:
11
commands.ts
11
commands.ts
@@ -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()
|
||||
}))
|
||||
}
|
||||
51
lang.ts
51
lang.ts
@@ -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)
|
||||
|
||||
}
|
||||
40
main.ts
40
main.ts
@@ -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);
|
||||
Reference in New Issue
Block a user