aboutsummaryrefslogtreecommitdiff
path: root/bot.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2020-07-20 16:22:28 -0400
committerAndrew Lee <alee14498@protonmail.com>2020-07-20 16:22:28 -0400
commit3466ad9526d1f85e463a7b7e9eefafce0962262f (patch)
treefbcbf8d9f7515f8d91923e934ea5de105a3b07f1 /bot.js
parentcd19676edd81612d97008948e4ae1a57fa394e0f (diff)
downloadDLAP-3466ad9526d1f85e463a7b7e9eefafce0962262f.tar.gz
DLAP-3466ad9526d1f85e463a7b7e9eefafce0962262f.tar.bz2
DLAP-3466ad9526d1f85e463a7b7e9eefafce0962262f.zip
About section
Diffstat (limited to 'bot.js')
-rw-r--r--bot.js37
1 files changed, 21 insertions, 16 deletions
diff --git a/bot.js b/bot.js
index d88d0d1..5574241 100644
--- a/bot.js
+++ b/bot.js
@@ -39,6 +39,7 @@ function playAudio() {
}).catch(e => {
console.error(e);
});
+
}
client.on('ready', () => {
console.log('Bot is ready!')
@@ -49,39 +50,36 @@ client.on('ready', () => {
});
client.on('message', async msg => {
- if (msg.author.bot) return;
- if (!msg.guild) return;
- if (!msg.content.startsWith(config.prefix)) return;
- let command = msg.content.split(' ')[0];
- command = command.slice(config.prefix.length);
+ if (msg.author.bot) return;
+ if (!msg.guild) return;
+ if (!msg.content.startsWith(config.prefix)) return;
+ let command = msg.content.split(' ')[0];
+ command = command.slice(config.prefix.length);
// Public allowed commands
if (command == 'help') {
- msg.channel.send(`Bot help:\n\`\`\`${config.prefix}help\n${config.prefix}ping\n${config.prefix}git\n\`\`\``)
+ msg.channel.send(`Bot help:\n\`\`\`${config.prefix}help\n${config.prefix}ping\n${config.prefix}git\n${config.prefix}about\n\`\`\``)
+ }
+
+ if (command == 'ping') {
+ msg.reply('Pong!');
}
if (command == 'git') {
msg.reply("This is the source code of this project.\nhttps://github.com/Alee14/PJ2020-Discord-Bot")
}
-
- if (command == 'ping') {
- msg.reply('Pong!');
+
+ if (command == 'about') {
+ msg.channel.send("This bot was created by Andrew Lee. Written in Discord.JS and licensed with GPL-3.0.")
}
if (![config.botOwner].includes(msg.author.id)) return;
// Bot owner exclusive
- if (command == 'stop') {
- await msg.reply('Powering off...')
- console.log('Powering off...');
- client.destroy();
- process.exit(0);
- }
if (command == 'join') {
- // Only try to join the sender's voice channel if they are in one themselves
msg.reply('Joining voice channel.');
playAudio();
}
@@ -97,4 +95,11 @@ client.on('message', async msg => {
channel.leave();
}
+ if (command == 'stop') {
+ await msg.reply('Powering off...')
+ console.log('Powering off...');
+ client.destroy();
+ process.exit(0);
+ }
+
}); \ No newline at end of file