aboutsummaryrefslogtreecommitdiff
path: root/commands
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2021-07-31 16:38:15 -0400
committerAndrew Lee <alee14498@protonmail.com>2021-07-31 16:38:15 -0400
commit60cd96e366487b9a422ecc685b46a2b300c32be1 (patch)
tree6e71adf12473ca438f10d7716a27a3f0ffc44c3d /commands
parent3aa27777a7bd1a9bff798412382db8aad3cbd19a (diff)
downloadAleeBot-60cd96e366487b9a422ecc685b46a2b300c32be1.tar.gz
AleeBot-60cd96e366487b9a422ecc685b46a2b300c32be1.tar.bz2
AleeBot-60cd96e366487b9a422ecc685b46a2b300c32be1.zip
Cleanup; Upgraded to Discord.JS v13; More buttons
Diffstat (limited to 'commands')
-rw-r--r--commands/about.js28
-rw-r--r--commands/ban.js10
-rw-r--r--commands/eval.js6
-rw-r--r--commands/git.js17
-rw-r--r--commands/help.js4
-rw-r--r--commands/info.js7
-rw-r--r--commands/interrogate.js8
-rw-r--r--commands/jail.js8
-rw-r--r--commands/kick.js10
-rw-r--r--commands/leaveguild.js4
-rw-r--r--commands/nick.js2
-rw-r--r--commands/poweroff.js2
-rw-r--r--commands/serverinfo.js18
-rw-r--r--commands/setprefix.js2
-rw-r--r--commands/slowdown.js2
-rw-r--r--commands/suggest.js12
-rw-r--r--commands/suggestfeature.js9
-rw-r--r--commands/userinfo.js6
18 files changed, 81 insertions, 74 deletions
diff --git a/commands/about.js b/commands/about.js
index fa9231d..81f9bf8 100644
--- a/commands/about.js
+++ b/commands/about.js
@@ -18,8 +18,7 @@
*
* *************************************/
module.exports.run = async (client, message) => {
- const { MessageEmbed } = require('discord.js');
- const { MessageButton, MessageActionRow } = require('discord-buttons');
+ const { MessageEmbed, MessageButton, MessageActionRow } = require('discord.js');
const aboutEmbed = new MessageEmbed()
.setAuthor(`AleeBot ${require('../storage/settings.json').abVersion}`, client.user.avatarURL())
@@ -28,20 +27,19 @@ module.exports.run = async (client, message) => {
.setFooter('© Copyright 2017-2021 Alee Productions, Licensed with GPL-3.0')
.setColor('#1fd619');
- let inviteBot = new MessageButton()
- .setStyle('url')
- .setLabel('Invite AleeBot')
- .setURL('https://top.gg/bot/282547024547545109');
+ let inviteButton = new MessageActionRow()
+ .addComponents(
+ new MessageButton()
+ .setStyle('LINK')
+ .setLabel('Invite AleeBot')
+ .setURL('https://top.gg/bot/282547024547545109'),
+ new MessageButton()
+ .setStyle('LINK')
+ .setLabel('Join Binaryworks Community')
+ .setURL('https://discord.gg/EFhRDqG')
+ );
- let inviteServer = new MessageButton()
- .setStyle('url')
- .setLabel('Join Binaryworks')
- .setURL('https://discord.gg/EFhRDqG');
-
- let buttons = new MessageActionRow()
- .addComponents(inviteBot, inviteServer);
-
- await message.channel.send(aboutEmbed, buttons);
+ await message.channel.send({embeds: [aboutEmbed], components: [inviteButton]});
};
exports.conf = {
diff --git a/commands/ban.js b/commands/ban.js
index 2c4950a..1e8ee6e 100644
--- a/commands/ban.js
+++ b/commands/ban.js
@@ -21,16 +21,16 @@ module.exports.run = async (client, message, args) => {
const Discord = require('discord.js');
const mreason = args.join(' ').slice(22);
if (!message.member.permissions.has('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to ban people.');
- if (!message.guild.member(client.user).hasPermission('BAN_MEMBERS')) return message.reply('Uhh... I don\'t have permission to ban members.');
+ if (!message.guild.members.cache.get(client.user.id).permissions.has('BAN_MEMBERS')) return message.reply('I don\'t have permission to ban members.');
const member = message.mentions.members.first();
- if (!member) return message.reply('Uhh... Please mention a member first.');
- await member.ban(`Banned by ${message.author.tag}. Reason: ${mreason}.`);
- const embed = new Discord.MessageEmbed()
+ if (!member) return message.reply('Please mention a member first.');
+ await member.ban({ reason: `Banned by ${message.author.tag} for ${mreason}.`});
+ const banEmbed = new Discord.MessageEmbed()
.setTitle('User Banned!')
.setColor('#1fd619')
.addField('**User:**', `${member.user.tag}`)
.addField('**Reason:**', `\`\`\`${mreason}\`\`\``);
- await message.channel.send({embed});
+ await message.channel.send({embeds: [banEmbed]});
};
exports.conf = {
diff --git a/commands/eval.js b/commands/eval.js
index 9ace7bf..b414225 100644
--- a/commands/eval.js
+++ b/commands/eval.js
@@ -47,7 +47,7 @@ module.exports.run = async (client, message, args) => {
.addField(':outbox_tray: Output:', `\`\`\`${err}\`\`\``)
.setFooter('Eval', client.user.avatarURL())
.setColor('RED');
- return message.channel.send({embed});
+ return message.channel.send({embeds: [embed]});
}
try {
@@ -59,7 +59,7 @@ module.exports.run = async (client, message, args) => {
.setFooter('Eval', client.user.avatarURL())
.setColor('GREEN');
- return message.channel.send({embed});
+ return message.channel.send({embeds: [embed]});
} catch (err) {
const embed = new MessageEmbed()
.setAuthor('Eval Error')
@@ -68,7 +68,7 @@ module.exports.run = async (client, message, args) => {
.addField(':outbox_tray: Output:', `\`\`\`${err}\`\`\``)
.setFooter('Eval', client.user.avatarURL())
.setColor('RED');
- return message.channel.send({embed});
+ return message.channel.send({embeds: [embed]});
}
};
diff --git a/commands/git.js b/commands/git.js
index 4f44edb..8f6af1f 100644
--- a/commands/git.js
+++ b/commands/git.js
@@ -18,16 +18,23 @@
*
* *************************************/
module.exports.run = async (client, message) => {
- const Discord = require('discord.js');
+ const { MessageEmbed, MessageButton, MessageActionRow } = require('discord.js');
const git = require('git-last-commit');
git.getLastCommit(function(err, commit) {
- const embed = new Discord.MessageEmbed()
- .setTitle('GitHub Information')
- .addField('**Repository:**', 'https://github.com/aleeproductions/AleeBot')
+ const gitInfo = new MessageEmbed()
+ .setTitle('Git Information')
.addField('**Last Commit:**', commit.subject)
.addField('**Commited By:**', commit.author.name)
.setColor('#1fd619');
- message.channel.send({embed});
+
+ let sourceCode = new MessageActionRow()
+ .addComponents(
+ new MessageButton()
+ .setStyle('LINK')
+ .setLabel('Source Code')
+ .setURL('https://github.com/aleeproductions/AleeBot')
+ );
+ message.channel.send({embeds: [gitInfo], components: [sourceCode]});
});
};
diff --git a/commands/help.js b/commands/help.js
index 2dafe0c..2bad795 100644
--- a/commands/help.js
+++ b/commands/help.js
@@ -38,7 +38,7 @@ module.exports.run = async (client, message) => {
}
const prefix = prefixes[message.guild.id].prefixes;
- if (!message.guild.member(client.user).hasPermission('EMBED_LINKS')) return message.reply('ERROR: AleeBot doesn\'t have the permission to send embed links please enable them to use the full help.');
+ if (!message.guild.members.cache.get(client.user.id).permissions.has('EMBED_LINKS')) return message.reply('ERROR: AleeBot doesn\'t have the permission to send embed links, please enable them to use the full help.');
const embed = new Discord.MessageEmbed()
.setAuthor('AleeBot ' + require('../storage/settings.json').abVersion + ` Help and on ${client.guilds.cache.size} servers`, client.user.avatarURL())
.setDescription('Every command you input into AleeBot is `' + prefix + '`')
@@ -55,7 +55,7 @@ module.exports.run = async (client, message) => {
embed.addField(x, cat, true);
});
- await message.channel.send({embed});
+ await message.channel.send({embeds: [embed]});
};
exports.conf = {
diff --git a/commands/info.js b/commands/info.js
index 4476ac0..bae45d4 100644
--- a/commands/info.js
+++ b/commands/info.js
@@ -18,18 +18,19 @@
*
* *************************************/
module.exports.run = async (client, message) => {
- const Discord = require('discord.js');
+ const { MessageEmbed, version } = require('discord.js');
const os = require('os');
const mongoose = require('mongoose');
- const embed = new Discord.MessageEmbed()
+ const embed = new MessageEmbed()
.setTitle('Information on AleeBot\'s Host')
.addField('OS Hostname: ', os.hostname(), true)
.addField('NodeJS Version: ', process.versions.node, true)
+ .addField('Discord.JS Version: ', version , true)
.addField('OS Platform: ', os.platform(), true)
.addField('OS Version: ', os.release(), true)
.addField('Mongoose Version:', mongoose.version, true)
.setColor('#1fd619');
- await message.channel.send({embed});
+ await message.channel.send({ embeds: [embed] });
};
exports.conf = {
diff --git a/commands/interrogate.js b/commands/interrogate.js
index 1b9b97b..16a1887 100644
--- a/commands/interrogate.js
+++ b/commands/interrogate.js
@@ -18,10 +18,10 @@
*
* *************************************/
module.exports.run = async (client, message, args) => {
- if (message.guild.id != '243022206437687296') return message.reply('This is a ALP exclusive command.');
+ if (message.guild.id != '243022206437687296') return message.reply('This is a Binaryworks exclusive command.');
- if (!message.member.hasPermission('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.');
- if (!message.guild.member(client.user).hasPermission('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.');
+ if (!message.member.permissions.has('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.');
+ if (!message.guild.members.cache.get(client.user.id).permissions.has('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.');
const member = message.mentions.members.first();
if (!member) return await message.reply('Uhh... Please mention a member first.');
@@ -38,5 +38,5 @@ exports.help = {
name: 'interrogate',
description: 'Interrogates a member',
usage: 'interrogate [user]',
- category: '- ALP Exclusive Commands',
+ category: '- Binaryworks Exclusive Commands',
};
diff --git a/commands/jail.js b/commands/jail.js
index a82e1b2..7f6f3a3 100644
--- a/commands/jail.js
+++ b/commands/jail.js
@@ -18,10 +18,10 @@
*
* *************************************/
module.exports.run = async (client, message, args) => {
- if (message.guild.id != '243022206437687296') return message.reply('This is a ALP exclusive command.');
+ if (message.guild.id != '243022206437687296') return message.reply('This is a Binaryworks exclusive command.');
- if (!message.member.hasPermission('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.');
- if (!message.guild.member(client.user).hasPermission('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.');
+ if (!message.member.permissions.has('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.');
+ if (!message.guild.members.cache.get(client.user.id).permissions.has('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.');
const member = message.mentions.members.first();
if (!member) return await message.reply('Uhh... Please mention a member first.');
@@ -38,5 +38,5 @@ exports.help = {
name: 'jail',
description: 'Jails a member',
usage: 'jail [user]',
- category: '- ALP Exclusive Commands',
+ category: '- Binaryworks Exclusive Commands',
};
diff --git a/commands/kick.js b/commands/kick.js
index 79cd964..1bf83db 100644
--- a/commands/kick.js
+++ b/commands/kick.js
@@ -21,16 +21,16 @@ module.exports.run = async (client, message, args) => {
const Discord = require('discord.js');
const mreason = args.join(' ').slice(22);
if (!message.member.permissions.has('KICK_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to kick people.');
- if (!message.guild.member(client.user).hasPermission('KICK_MEMBERS')) return message.reply('Uhh... I don\'t have permission to kick members.');
+ if (!message.guild.members.cache.get(client.user.id).permissions.has('KICK_MEMBERS')) return message.reply('I don\'t have permission to kick members.');
const member = message.mentions.members.first();
- if (!member) return message.reply('Uhh... Please mention a member first.');
- await member.kick(`Kicked by: ${message.author.tag}. Reason: ${mreason}.`);
- const embed = new Discord.MessageEmbed()
+ if (!member) return message.reply('Please mention a member first.');
+ await member.kick(`Kicked by ${message.author.tag} for ${mreason}.`);
+ const kickEmbed = new Discord.MessageEmbed()
.setTitle('User Kicked!')
.setColor('#1fd619')
.addField('**User:**', `${member.user.tag}`)
.addField('**Reason:**', `\`\`\`${mreason}\`\`\``);
- await message.channel.send({embed});
+ await message.channel.send({embeds: [kickEmbed]});
};
exports.conf = {
diff --git a/commands/leaveguild.js b/commands/leaveguild.js
index 146512c..f88f0bb 100644
--- a/commands/leaveguild.js
+++ b/commands/leaveguild.js
@@ -18,8 +18,8 @@
*
* *************************************/
module.exports.run = async (client, message) => {
- if (!['242775871059001344', message.guild.owner.user.id].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot or the owner of this guild to use this command.');
- message.channel.send('Alright, I\'m leaving the server now. Bye everyone!');
+ if (!['242775871059001344', message.guild.ownerID].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot or the owner of this guild to use this command.');
+ await message.channel.send('Leaving server. If that\'s a mistake, you can re-invite me...');
message.guild.leave();
};
diff --git a/commands/nick.js b/commands/nick.js
index d87d57e..8fcdce7 100644
--- a/commands/nick.js
+++ b/commands/nick.js
@@ -18,7 +18,7 @@
*
* *************************************/
module.exports.run = async (client, message, args) => {
- if (!message.guild.member(client.user).hasPermission('MANAGE_NICKNAME')) return message.reply('**ERROR:** I can\'t change nicknames. (Check permissions)');
+ if (!message.guild.members.cache.get(client.user.id).permissions.has('MANAGE_NICKNAME')) return message.reply('**ERROR:** I can\'t change nicknames. (Check permissions)');
const nick = args.join(' ');
message.member.setNickname(nick);
message.channel.send(`Alright! I changed your nickname to \`${nick}\``);
diff --git a/commands/poweroff.js b/commands/poweroff.js
index 700005a..22fb6bb 100644
--- a/commands/poweroff.js
+++ b/commands/poweroff.js
@@ -27,7 +27,7 @@ module.exports.run = async (client, message) => {
let statusChannel = client.channels.cache.get('606602551634296968');
if (!statusChannel) return console.error('The status channel does not exist! Skipping.');
- await statusChannel.send(stopEmbed);
+ await statusChannel.send({ embeds: [stopEmbed]});
await message.reply(':warning: AleeBot will now exit!');
console.log('[i] AleeBot will now exit!'.blue);
client.destroy();
diff --git a/commands/serverinfo.js b/commands/serverinfo.js
index 9ccb7c2..049ad98 100644
--- a/commands/serverinfo.js
+++ b/commands/serverinfo.js
@@ -20,23 +20,23 @@
module.exports.run = async (client, message) => {
const Discord = require('discord.js');
const listedChannels = [];
- let memberCountNoBots = message.guild.members.cache.filter(member => !member.user.bot).size;
+ let memberCountNoBots = await message.guild.members.fetch().then((members) => members.filter(member => !member.user.bot).size);
const embed = new Discord.MessageEmbed()
- .setAuthor(message.guild.name, message.guild.iconURL())
+ .setAuthor(`${message.guild.name}`, `${message.guild.iconURL()}`)
.setDescription('Server Information')
- .setThumbnail(message.guild.iconURL())
- .addField('Server Name:', message.guild.name)
- .addField('Server ID:', message.guild.id)
- .addField('Create At:', message.guild.createdAt.toUTCString())
+ .setThumbnail(`${message.guild.iconURL()}`)
+ .addField('Server Name:', `${message.guild.name}`)
+ .addField('Server ID:', `${message.guild.id}`)
+ .addField('Create At:', `${message.guild.createdAt.toUTCString()}`)
/*message.guild.channels.cacheType.forEach(channel => {
listedChannels.push(channel)
})*/
//.addField('Channels', `${listedChannels.join('\n')}`)
//.addField('Total Channels', message.guild.channelCountMode)
- .addField('Total Members (with bots)', message.guild.memberCount)
- .addField('Total Members (without bots)', memberCountNoBots)
+ .addField('Total Members (with bots)', `${message.guild.memberCount}`)
+ .addField('Total Members (without bots)', `${memberCountNoBots}`)
.setColor('#1fd619');
- await message.channel.send({embed});
+ await message.channel.send({embeds: [embed]});
};
exports.conf = {
diff --git a/commands/setprefix.js b/commands/setprefix.js
index 2bea4bc..6800eea 100644
--- a/commands/setprefix.js
+++ b/commands/setprefix.js
@@ -23,7 +23,7 @@ module.exports.run = async (client, message, args) => {
console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${message}`);
};
const fs = require('fs');
- if (!message.member.hasPermission('ADMINISTRATOR')) return message.reply('Sorry you need admin to set my prefix');
+ if (!message.member.permissions.has('ADMINISTRATOR')) return message.reply('Sorry you need admin to set my prefix');
if (!args[0] || args[0 == 'help']) return message.reply('Usage: <your prefix>setprefix <prefix>');
const prefixes = JSON.parse(fs.readFileSync('./storage/prefixes.json', 'utf8'));
diff --git a/commands/slowdown.js b/commands/slowdown.js
index 008ceb6..44d8230 100644
--- a/commands/slowdown.js
+++ b/commands/slowdown.js
@@ -21,7 +21,7 @@ module.exports.run = async (client, message, args) => {
if (!message.member.permissions.has('MANAGE_CHANNELS')) return message.reply('It looks like that you don\'t have the permissions to slowdown channels.');
if (isNaN(args[0])) return message.reply('Please input a valid number to slowdown a channel.');
await message.channel.setRateLimitPerUser(args[0]);
- message.channel.send(`This channel has been ratelimited for ${args[0]} second(s).`);
+ message.channel.send(`This channel has been slowdowned for ${args[0]} second(s).`);
};
diff --git a/commands/suggest.js b/commands/suggest.js
index 3a8e34a..0ca21b8 100644
--- a/commands/suggest.js
+++ b/commands/suggest.js
@@ -18,15 +18,15 @@
*
* *************************************/
module.exports.run = async (client, message, args) => {
- if (message.guild.id != '243022206437687296') return message.reply('This is a ALP exclusive command.');
+ if (message.guild.id != '243022206437687296') return message.reply('This is a Binaryworks exclusive command.');
const {MessageEmbed} = require('discord.js');
- client.channels.cache.get('427495678390960148').send(
+ client.channels.cache.get('427495678390960148').send({ embeds: [
new MessageEmbed()
.setColor('#1fd619')
.setTitle('Suggestion')
- .setDescription('This is a suggestion from '+ message.author.username +' please react to it using the following emojis.')
+ .setDescription('This is a suggestion from '+ message.author.username +'. Please react to it using the following emojis.')
.addField('Suggestion Contents', args.join(' ')),
- ).then((message) => {
+ ]}).then((message) => {
message.react('\u2705');
message.react('\u274E');
});
@@ -39,7 +39,7 @@ exports.conf = {
};
exports.help = {
name: 'suggest',
- description: 'Suggest a feature in ALP.',
+ description: 'Suggest a feature in Binaryworks.',
usage: 'suggest [suggestion]',
- category: '- ALP Exclusive Commands',
+ category: '- Binaryworks Exclusive Commands',
};
diff --git a/commands/suggestfeature.js b/commands/suggestfeature.js
index 28fc01a..c7623d2 100644
--- a/commands/suggestfeature.js
+++ b/commands/suggestfeature.js
@@ -20,14 +20,15 @@
module.exports.run = async (client, message, args) => {
const { MessageEmbed } = require('discord.js');
- client.channels.cache.get('427495678390960148').send(
+ client.channels.cache.get('427495678390960148').send({ embeds: [
new MessageEmbed()
- .setColor ('#1fd619')
+ .setColor('#1fd619')
.setTitle('AleeBot Feature Suggestion')
- .setDescription('This is an AleeBot feature suggestion from '+ message.author.username +` sending from ${message.guild.name}.`)
+ .setDescription(`This is an AleeBot feature suggested from ${message.author.username}.`)
.addField('Suggestion Contents', args.join(' '))
+ .setFooter(`Sending from ${message.guild.name}`, message.guild.iconURL())]}
);
- await message.reply('Your suggestion has been shown to the ALP discord server!');
+ await message.reply('Your suggestion has been shown to the Binaryworks discord server!');
};
diff --git a/commands/userinfo.js b/commands/userinfo.js
index d90f7bf..a812dc4 100644
--- a/commands/userinfo.js
+++ b/commands/userinfo.js
@@ -23,11 +23,11 @@ module.exports.run = async (client, message) => {
.setAuthor(message.author.tag, message.author.avatarURL())
.setDescription('User Information')
.setThumbnail(message.author.avatarURL())
- .addField('Names', '**Username:** ' + message.author.username + '\n**Current Nickname:** ' + message.member.displayName)
+ .addField('Names', `**Username:** ${message.author.username}\n**Current Nickname:** ${message.member.displayName}`)
.addField('Identity', `**User ID:** ${message.author.id} `)
- .addField('Create and Join Times', '**Created At:** ' + message.member.user.createdAt.toUTCString() + '\n**Joined Guild At:** ' + message.member.joinedAt.toUTCString())
+ .addField('Create and Join Times', `**Created At:** ${message.member.user.createdAt.toUTCString()}\n**Joined Guild At:** ${message.member.joinedAt.toUTCString()}`)
.setColor('#1fd619');
- await message.channel.send({embed});
+ await message.channel.send({embeds: [embed]});
};