summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-07 11:31:04 -0700
committer8cy <[email protected]>2020-04-07 11:31:04 -0700
commitffe5c7d561396e1dd752c8a0db8a48fed0254b3c (patch)
tree3b8d3602a305e952f132c54e611bc71e43f0a1c2
parentnew token, v1.0.1 (diff)
downloadchester-ffe5c7d561396e1dd752c8a0db8a48fed0254b3c.tar.xz
chester-ffe5c7d561396e1dd752c8a0db8a48fed0254b3c.zip
add uptime command, v1.0.1
-rw-r--r--app.js129
-rw-r--r--package.json2
2 files changed, 14 insertions, 117 deletions
diff --git a/app.js b/app.js
index 68299ef..216926a 100644
--- a/app.js
+++ b/app.js
@@ -7,28 +7,25 @@ const atquotes = require('at-quotes');
const ytdl = require('ytdl-core');
bot.on('ready', () => {
- console.log(`Started bot: ${bot.user.tag} (ID: ${bot.user.id})\nCurrently running on ${bot.guilds.size} server(s).`); // Startup dialouge in output console
- bot.user.setActivity('with squeaky toy :D', { // Set status
+ 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', {
type: 'PLAYING'
});
-
- // Outputs available commands in output console
- //commands = ['bot', 'help'];
- //console.log(commands);
});
-// Outputs errors in console window
bot.on('error', console.error);
// Start Bot Commands
bot.on('message', async msg => {
- //console.log(msg.content.toLowerCase());
- if (msg.channel.name === 'bots' || msg.channel.name === 'bot-commands' || msg.member.hasPermission('KICK_MEMBERS')) {
+ //if (msg.channel.name === 'bots' || msg.channel.name === 'bot-commands' || msg.member.hasPermission('KICK_MEMBERS')) {
+ const upTime = require('moment');
+ require('moment-duration-format');
+ const duration = upTime.duration(bot.uptime).format(" D [days], H [hrs], m [mins], s [secs]");
+
var msgContent = msg.content.toLowerCase();
if (prefixCheck()) {
console.log(msg.member.user.tag, 'says', msgContent, 'in #' + msg.channel.name);
}
- //console.log(config.prefixes.main);
// Check prefixies in config.json
function prefixCheck() {
@@ -157,18 +154,6 @@ bot.on('message', async msg => {
msg.reply('reboot finished lol');
}
- /*if (command == 'pause') {
- dispatcher.pause();
- }
-
- if (command == 'resume' || 'play') {
- dispatcher.resume();
- }
-
- if (command == 'volume' || 'vol') {
-
- }*/
-
// Clear/ delete messages in bulk command
if (command == 'clear' || command == 'delete' || command == 'del' || command == 'c') {
if (msg.member.hasPermission('MANAGE_MESSAGES')) {
@@ -233,40 +218,8 @@ bot.on('message', async msg => {
.setColor(0xFFE4BA);
msg.channel.send(RichEmbed = emb);
- })
+ });
}
-
- // This shit took about an hour and a half to debug because I couldn't figure out how to convert the first arguement into
- // a user id. After getting help from discord.js Discord I fixed it for about 30 seconds at 21:26 and then I broke it again instantlly
- // after. Then I tried to fix everything and I almost broke everything again but I realized it was broken because I did s5n!dm instead
- // of s5n!test and I hadn't ported the code over from test to. 2020/04/02, 21:34
- //where sendTo and d went
- //args[0] = args[0].id
- //msg.reply(args[0]);
- // args[0];
-
- // msg.reply(typeof args[0]) // for debugging
-
- // const collector = new Discord.MessageCollector(msg.channel, m => m.author.id === msg.author.id, {
- // time: 5000
- // });
- // msg.reply('timed out', 5000)
- // //console.log(collector)
-
- // collector.on('collect', message => {
- // var messageText = message.content;
-
- // if (msg.member.message) {
- // msg.reply('received')
- // }
- // })
-
- // msg.reply('what would you like to say?');
- // if (msg.member.lastMessage) {
- // var messageText = msg.member.lastMessage.content;
- // }
-
- // where send function went
} else {
msg.reply('insufficent perms bruh');
}
@@ -292,68 +245,10 @@ bot.on('message', async msg => {
msg.reply('my owner is papa frozen');
}
- /*if (command == 'botstatus' || command == 'status' || command == 'bs') {
- if (msg.member.hasPermission('KICK_MEMBERS')) {
- if (!args) {
- msg.reply('no status specified')
- }
-
- if (args == 'online') {
- bot.user.setStatus("online");
- } else if (args == 'idle') {
- bot.user.setStatus("idle");
- } else if (args == 'dnd') {
- bot.user.setStatus("dnd");
- } else if (args == 'invisable') {
- bot.user.setStatus("invisable");
- }
- } else {
- msg.reply('insufficent perms bruh');
- }
- }*/
-
- // Change status and status message
- /*if (command == 'botstatus' || command == 'status' || command == 'bs') {
- if (msg.member.hasPermission('KICK_MEMBERS')) {
- if (!args[0] && !args[1]) {
- msg.reply('you haven\'t specified a status or a message.')
- } else if (!args[1]) {
- msg.reply('you haven\'t specified a message.')
- } else if (!args[0]) {
- msg.reply('you haven\'t specified a status.')
- } else {
- status = args[0].toLocaleUpperCase();
- var d = new Date(msg.createdTimestamp);
-
- bot.user.setActivity(args[1], {
- type: status
- });
-
- let emb = new Discord.RichEmbed()
-
- //.setDescription(`to view the commands in each group use:\n\`s5n!commands <group>\``)
- .addField(`status message`, args[1], true)
- .addField(`status`, status, true)
- .addField(`time changed`, d)
- .setColor(0xFFE4BA);
-
- msg.channel.send(RichEmbed = emb);
- }
- }
- }*/
-
- /*function joinCheck() {
- switch (msg.guild.voiceConnection) {
- case !msg.guild.voiceConnection && msg.member.voiceChannel:
- msg.member.voiceChannel.join();
- msg.reply('succesfully joined voice channel')
- case (msg.guild.voiceConnection):
- msg.reply('i\'m already in voice channel')
- case (!msg.member.voiceChannel):
- msg.reply('you\'re not in a voice channel')
- }
- }*/
- } else if (msg.channel.name !== 'bots' && msg.content.startsWith(`${config.prefixes.main}`) && !msg.member.hasPermission('KICK_MEMBERS')) return;
+ if (command == 'uptime' || command == 'ut') {
+ msg.reply(duration);
+ }
+ //} else if (msg.channel.name !== 'bots' && msg.content.startsWith(`${config.prefixes.main}`) && !msg.member.hasPermission('KICK_MEMBERS')) return;
})
// Get bot token
diff --git a/package.json b/package.json
index 9e0f1e4..4910456 100644
--- a/package.json
+++ b/package.json
@@ -16,6 +16,8 @@
"emoji-random": "^0.1.2",
"ffmpeg-static": "^4.0.1",
"is-image-url": "^1.1.8",
+ "moment": "^2.24.0",
+ "moment-duration-format": "^2.3.2",
"ytdl-core": "^2.0.1"
}
}