TravBot-v3/src/index.ts

39 lines
1.1 KiB
TypeScript
Raw Normal View History

2020-12-15 01:44:28 +00:00
import {Client} from "discord.js";
import setup from "./setup";
import {Config} from "./core/structures";
import {loadCommands} from "./core/command";
import {loadEvents} from "./core/event";
import "discord.js-lavalink-lib";
import LavalinkMusic from "discord.js-lavalink-lib";
2020-07-25 11:01:24 +00:00
// This is here in order to make it much less of a headache to access the client from other files.
// This of course won't actually do anything until the setup process is complete and it logs in.
export const client = new Client();
(client as any).music = LavalinkMusic(client, {
2020-12-15 01:44:28 +00:00
lavalink: {
restnode: {
host: "localhost",
port: 2333,
password: "youshallnotpass"
},
nodes: [
{
host: "localhost",
port: 2333,
password: "youshallnotpass"
}
]
},
2020-12-15 01:44:28 +00:00
prefix: "!!",
helpCmd: "mhelp",
admins: ["717352467280691331"]
});
2020-07-25 11:01:24 +00:00
// Begin the command loading here rather than when it's needed like in the message event.
setup.init().then(() => {
2020-12-15 01:44:28 +00:00
loadCommands();
loadEvents(client);
client.login(Config.token).catch(setup.again);
2020-10-15 09:23:24 +00:00
});