summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-11 01:35:45 -0700
committer8cy <[email protected]>2020-04-11 01:35:45 -0700
commit69f523c2ccc569e524a41ab11e956c60587bb055 (patch)
tree3eba1ca821e23dea22792feb694cc279e5caa52a
parentremove a lot, v1.1.0 (diff)
downloadchester-69f523c2ccc569e524a41ab11e956c60587bb055.tar.xz
chester-69f523c2ccc569e524a41ab11e956c60587bb055.zip
v12 update + changes, v2.0.0HEADmaster
- port to v12 - remove features - add features - fix features - fix bot lol
-rw-r--r--app.js97
-rw-r--r--config.json11
-rw-r--r--package.json2
3 files changed, 49 insertions, 61 deletions
diff --git a/app.js b/app.js
index 1cc2b0c..688dfda 100644
--- a/app.js
+++ b/app.js
@@ -1,48 +1,46 @@
const Discord = require('discord.js');
+const client = new Discord.Client();
const config = require('./config.json');
-const bot = new Discord.Client();
const emoji = require('emoji-random');
-bot.on('ready', () => {
- console.log(`Started bot: ${bot.user.tag} (ID: ${bot.user.id})\nCurrently running on ${bot.guilds.size} server(s).`);
- bot.user.setActivity('with squeaky toy :D', {
+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('with my squeaky toy :D', {
type: 'PLAYING'
});
});
-bot.on('error', console.error);
+client.on('error', console.error);
-bot.on('message', async msg => {
+client.on('message', async msg => {
const upTime = require('moment');
require('moment-duration-format');
- const duration = upTime.duration(bot.uptime).format(" D [days], H [hrs], m [mins], s [secs]");
+ const duration = upTime.duration(client.uptime).format(" D [days], H [hrs], m [mins], s [secs]");
- function prefixCheck() {
- if (msgContent.startsWith('c!')) {
- return true;
- }
- var msgContent = msg.content.toLowerCase();
+ function prefixCheck() { if (msg.content.startsWith(config.prefix)) return true; }
if (prefixCheck()) {
- console.log(msg.member.user.tag, 'says', msgContent, 'in #' + msg.channel.name);
+ console.log(msg.member.user.tag, 'says', msg.content.toLowerCase(), 'in #' + msg.channel.name);
+ var args = msg.content.slice(config.prefix.length).split(/ +/);
+ var cmd = args.shift().toLowerCase();
}
- if (command == 'ping' || command == 'ms') {
+ if (cmd == 'ping' || cmd == 'ms' || cmd == 'p') {
const t = Date.now();
msg.channel.send('plz wait..').then(m => {
m.edit(`** **`);
const n = Date.now();
- let emb = new Discord.RichEmbed()
- .setDescription(`bork! chesters's is \`${n - t}ms\`. heartbeat \`${bot.ping}ms\`.`)
- .setColor(0xFFE4BA);
+ let emb = new Discord.MessageEmbed()
+ .setDescription(`bork! chesters's is \`${n - t}ms\`. heartbeat \`${client.ws.ping}ms\`. ` + emoji.random())
+ .setColor(0xFFE4BA);
- msg.channel.send(RichEmbed = emb);
+ msg.channel.send(emb);
});
}
- if (command == 'say') {
+ if (cmd == 'say' || cmd == 's') {
if (msg.member.hasPermission('KICK_MEMBERS')) {
m = args.join(' ');
msg.channel.send(m);
@@ -50,52 +48,51 @@ bot.on('message', async msg => {
}
}
- if (command == 'leave') {
- if (msg.guild.voiceConnection) {
- msg.guild.voiceConnection.disconnect();
- msg.reply('succesfully left voice channel');
+ if (cmd == 'leave' || cmd == 'l') {
+ if (msg.guild.voice) {
+ msg.guild.voice.disconnect();
+ msg.reply('succesfully left voice channel ' + emoji.random());
} else {
- msg.reply('i\'m not in a voice channel' + emoji.random());
+ msg.reply('i\'m not in a voice channel ' + emoji.random());
}
}
- if (command == 'join') {
- if (!msg.guild.voiceConnection && msg.member.voiceChannel) {
- msg.member.voiceChannel.join();
- msg.reply('succesfully joined voice channel' + emoji.random());
- } else if (msg.guild.voiceConnection) {
- msg.reply('i\'m already in voice channel' + emoji.random());
- } else if (!msg.member.voiceChannel) {
- msg.reply('you\'re not in a voice channel' + emoji.random());
+ if (cmd == 'join' || cmd == 'j') {
+ if (!msg.guild.voice && msg.member.voice.channel) {
+ msg.member.voice.channel.join();
+ msg.reply('succesfully joined voice channel ' + emoji.random());
+ } else if (msg.guild.voice) {
+ msg.reply('i\'m already in voice channel ' + emoji.random());
+ } else if (!msg.member.voice.channel) {
+ msg.reply('you\'re not in a voice channel ' + emoji.random());
}
}
- if (command == 'reboot' | command == 'r') {
- msg.member.voiceChannel.join();
- msg.member.voiceChannel.leave();
- msg.reply('reboot finished lol' + emoji.random());
- }
-
if (msg.mentions.everyone) {
msg.react(':ArisaPing:695887537390223402');
}
- if (msg.content == 'dog' | msg.content == 'dogs' | msg.content == 'bark' | msg.content == 'bork' | msg.content == 'woof') {
+ if (msg.content == 'dog' || msg.content == 'dogs' || msg.content == 'bark' || msg.content == 'bork' || msg.content == 'woof' || msg.content == 'mutt') {
var borkNum = Math.floor((Math.random() * 3) + 1);
+ var specialBork = Math.floor((Math.random() * 10) + 1);
+ var specialBorkCheck = Math.floor((Math.random() * 10) + 1);
- if (borkNum == 1) {
- msg.reply('bork' + emoji.random());
- } else if (borkNum == 2) {
- msg.reply('bark' + emoji.random());
- } else if (borkNum == 3) {
- msg.reply('woof' + emoji.random());
+ if (specialBork == specialBorkCheck) {
+ msg.reply('you got the special bork, this was a 1 in 100 chance of getting ' + emoji.random());
+ } else {
+ if (borkNum == 1) {
+ msg.reply('bork ' + emoji.random());
+ } else if (borkNum == 2) {
+ msg.reply('bark ' + emoji.random());
+ } else if (borkNum == 3) {
+ msg.reply('woof ' + emoji.random());
+ }
}
}
- if (command == 'uptime' || command == 'ut') {
- msg.reply(duration + emoji.random());
+ if (cmd == 'uptime' || cmd == 'ut') {
+ msg.reply(duration + ' ' + emoji.random());
}
-})
+});
-// Get bot token
-bot.login(config['secret']) \ No newline at end of file
+client.login(config['secret']); \ No newline at end of file
diff --git a/config.json b/config.json
index f5d8a02..c68fb98 100644
--- a/config.json
+++ b/config.json
@@ -1,13 +1,4 @@
{
"secret":"Njk3MDUyNjkwNzM5NDk0OTky.Xox2qw.7KkOOC5XM8El6gOneeTYJxSXLMU",
- "prefixes": {
- "main":"c!",
- "alt":"chester!",
- "alt2":"c-",
- "alt3":"chester- ",
- "alt4":"c.",
- "alt5":"chester.",
- "alt6":"<@!697052690739494992> ",
- "alt6b":"<@697052690739494992> "
- }
+ "prefix":"c!"
}
diff --git a/package.json b/package.json
index 4910456..444e388 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,7 @@
"@discordjs/opus": "^0.1.0",
"at-quotes": "^1.3.3",
"demojijs": "^1.2.0",
- "discord.js": "^11.6.3",
+ "discord.js": "^12.1.1",
"emoji-random": "^0.1.2",
"ffmpeg-static": "^4.0.1",
"is-image-url": "^1.1.8",