aboutsummaryrefslogtreecommitdiff
path: root/bot.ts
diff options
context:
space:
mode:
Diffstat (limited to 'bot.ts')
-rw-r--r--bot.ts64
1 files changed, 64 insertions, 0 deletions
diff --git a/bot.ts b/bot.ts
new file mode 100644
index 0000000..285f22a
--- /dev/null
+++ b/bot.ts
@@ -0,0 +1,64 @@
+const config = require('./config.json');
+const { CommandoClient } = require('discord.js-commando');
+import path from 'path';
+const { Structures } = require('discord.js');
+Structures.extend('Guild', Guild => {
+ class MusicGuild extends Guild {
+ constructor(client, data) {
+ super(client, data);
+ this.musicData = {
+ queue: [],
+ isPlaying: false,
+ volume: 1,
+ songDispatcher: null
+ };
+ }
+ }
+ return MusicGuild;
+});
+
+const client = new CommandoClient({
+ commandPrefix: 'msb!',
+ owner: '217348698294714370'
+});
+
+client.registry
+ .registerDefaultTypes()
+ .registerGroups([
+ ['voice', 'Voice Command Group'],
+ ['utility', 'Utility Command Group']
+ ])
+ .registerDefaultGroups()
+ .registerDefaultCommands({
+ help: false
+ })
+ .registerCommandsIn(path.join(__dirname, 'commands'));
+
+client.once('ready', () => {
+ console.log(`Started bot: ${client.user.tag} (ID: ${client.user.id})\nCurrently running on ${client.guilds.cache.size} server(s).`);
+ client.user.setActivity('msb!h | v1.1.1', {
+ type: 'LISTENING'
+ });
+ //client.channels.cache.get('600773421525237781').send('bot started up');
+});
+
+client.on('error', console.error);
+client.on('debug', console.debug);
+
+client.on('message', async msg => {
+ var msgContent = msg.content.toLowerCase();
+ function prefixCheck() {
+ if (msgContent.startsWith('msb!')) {
+ return true;
+ }
+ }
+ if (prefixCheck()) {
+ if (msg.channel.type == 'dm') {
+ console.log(msg.author.tag, 'says', msgContent, 'in a DM');
+ } else {
+ console.log(msg.member.user.tag, 'says', msgContent, 'in #' + msg.channel.name);
+ }
+ }
+});
+
+client.login(config['secret']);