summaryrefslogtreecommitdiff
path: root/src/bot.ts
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-13 05:32:35 -0700
committer8cy <[email protected]>2020-04-13 05:32:35 -0700
commit9dff52f7d047c905326bc2f476ede5463e00f2a0 (patch)
tree1fec8563b3b72fde9b2ab7ad9e56a97398798685 /src/bot.ts
parenttypescript (diff)
downloads5nical-9dff52f7d047c905326bc2f476ede5463e00f2a0.tar.xz
s5nical-9dff52f7d047c905326bc2f476ede5463e00f2a0.zip
typescript final
Diffstat (limited to 'src/bot.ts')
-rw-r--r--src/bot.ts71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/bot.ts b/src/bot.ts
new file mode 100644
index 0000000..dd06d56
--- /dev/null
+++ b/src/bot.ts
@@ -0,0 +1,71 @@
+import config from './config.json';
+import { CommandoClient } from 'discord.js-commando';
+import path from 'path';
+import { Structures } from 'discord.js';
+Structures.extend('Guild', Guild => {
+ class MusicGuild extends Guild {
+ musicData: { queue: never[]; isPlaying: boolean; volume: number; songDispatcher: null; };
+ constructor(client, data) {
+ super(client, data);
+ this.musicData = {
+ queue: [],
+ isPlaying: false,
+ volume: 1,
+ songDispatcher: null
+ };
+ }
+ }
+ return MusicGuild;
+});
+
+const client = new CommandoClient({
+ commandPrefix: 's5n!',
+ owner: '217348698294714370'
+});
+
+client.registry
+ .registerDefaultTypes()
+ .registerGroups([
+ ['fun', 'fun command group'],
+ ['moderation', 'moderation command group'],
+ ['utility', 'utility command group'],
+ ['voice', 'voice command group']
+ ])
+ .registerDefaultGroups()
+ .registerDefaultCommands({
+ help: true
+ })
+ .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('psycho~ uwu', {
+ 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('s5n!')) {
+ 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);
+ }
+ }
+
+ if (msg.mentions.everyone) {
+ msg.react(':ArisaPing:695887537390223402');
+ }
+});
+
+client.login(config['secret']); \ No newline at end of file