Major DIscord.js & Discord-akairo update

This commit is contained in:
loicbersier 2020-03-04 02:08:04 +01:00
parent 216aa515ba
commit 60f85fb5ff
30 changed files with 453 additions and 293 deletions

View file

@ -4,7 +4,7 @@ const BannedWords = require('../../models').bannedWords;
class BannedWordsCommand extends Command {
constructor() {
super('BannedWords', {
aliases: ['bannedword', 'banword', 'unbanword'],
aliases: ['bannedword', 'banword', 'unbanword', 'censor', 'uncensor'],
category: 'admin',
userPermissions: ['MANAGE_MESSAGES'],
clientPermissions: ['MANAGE_MESSAGES', 'SEND_MESSAGES'],

View file

@ -36,7 +36,7 @@ class fakebotCommand extends Command {
let Attachment = (message.attachments).array();
let url;
let username = args.user.username;
let member = message.guild.members.get(args.user.id);
let member = message.guild.members.resolve(args.user.id);
// Get attachment link
if (Attachment[0]) {
url = Attachment[0].url;

View file

@ -29,9 +29,9 @@ class fakejoinCommand extends Command {
if (join) {
if (args.user)
member = message.guild.members.get(args.user.id);
member = message.guild.members.resolve(args.user.id);
else
member = message.guild.members.get(message.author.id);
member = message.guild.members.resolve(message.author.id);
} else {
return message.channel.send('There is no join channel setup');
}

View file

@ -29,9 +29,9 @@ class fakeleaveCommand extends Command {
if (leave) {
if (args.user)
member = message.guild.members.get(args.user.id);
member = message.guild.members.resolve(args.user.id);
else
member = message.guild.members.get(message.author.id);
member = message.guild.members.resolve(message.author.id);
} else {
return message.channel.send('There is no leave channel setup');
}

View file

@ -4,8 +4,6 @@ const fetch = require('node-fetch');
const os = require('os');
const fs = require('fs');
const rand = require('../../rand.js');
//const Filter = require('bad-words');
//let filter = new Filter();
const TwitterBlacklist = require('../../models').TwitterBlacklist;
const { twiConsumer, twiConsumerSecret, twiToken, twiTokenSecret, twiChannel } = require('../../config.json');
@ -41,16 +39,16 @@ class tweetCommand extends Command {
if (blacklist) {
return message.channel.send(`You have been blacklisted for the following reasons: \`\`${blacklist.get('reason')}\`\` be less naughty less time.`);
}
// Don't let account new account use this command to prevent spam
if (message.author.createdAt > date.setDate(date.getDate() - 7)) {
return message.channel.send('Your account is too new to be able to use this command!');
}
// If account is younger than 6 months old don't accept attachment
if (Attachment[0] && message.author.createdAt > date.setMonth(date.getMonth() - 6)) {
return message.channel.send('Your account need to be 6 months or older to be able to send attachment!');
}
// Don't let account new account use this command to prevent spam
if (message.author.createdAt > date.setDate(date.getDate() - 7)) {
return message.channel.send('Your account is too new to be able to use this command!');
}
if (args.text.includes('discord.gg')) return message.channel.send('No discord invite allowed.');
@ -164,7 +162,7 @@ class tweetCommand extends Command {
if (Attachment[0]) publicEmbed.setImage(Attachment[0].url);
// Im too lazy for now to make an entry in config.json
let channel = client.channels.get('597964498921455637');
let channel = client.channels.resolve('597964498921455637');
channel.send({embed: publicEmbed});
const Embed = client.util.embed()
@ -178,7 +176,7 @@ class tweetCommand extends Command {
if (Attachment[0]) Embed.setImage(Attachment[0].url);
channel = client.channels.get(twiChannel);
channel = client.channels.resolve(twiChannel);
channel.send({embed: Embed});
return message.channel.send(`Go see ur epic tweet https://twitter.com/i/status/${tweetid}`);
});

View file

@ -43,7 +43,7 @@ class addDonatorCommand extends Command {
if (!Donator) {
const body = {userID: args.id, comment: userComment};
donator.create(body);
return message.channel.send(`A new donator have been added! ${this.client.users.get(args.id).username}#${this.client.users.get(args.id).discriminator} (${args.id}) ${userComment}`);
return message.channel.send(`A new donator have been added! ${this.client.users.resolve(args.id).username}#${this.client.users.resolve(args.id).discriminator} (${args.id}) ${userComment}`);
} else {
message.channel.send('This donator already exist, do you want to update it? y/n');
const filter = m => m.content && m.author.id == message.author.id;
@ -55,9 +55,9 @@ class addDonatorCommand extends Command {
donator.update(body, {where: {userID: args.id}});
console.log(userComment);
if (userComment == '') {
return message.channel.send(`Removed the comment from ${this.client.users.get(args.id).username}#${this.client.users.get(args.id).discriminator} (${args.id})`);
return message.channel.send(`Removed the comment from ${this.client.users.resolve(args.id).username}#${this.client.users.resolve(args.id).discriminator} (${args.id})`);
} else {
return message.channel.send(`You edited the comment for ${this.client.users.get(args.id).username}#${this.client.users.get(args.id).discriminator} (${args.id}) with ${args.userComment}`);
return message.channel.send(`You edited the comment for ${this.client.users.resolve(args.id).username}#${this.client.users.resolve(args.id).discriminator} (${args.id}) with ${args.userComment}`);
}
}
})

View file

@ -32,7 +32,7 @@ class blacklistCommand extends Command {
if (!blacklist) {
const body = {userID: args.userID};
userBlacklist.create(body);
return message.channel.send(`The following user have been blacklisted: ${this.client.users.get(args.userID).username}#${this.client.users.get(args.userID).discriminator} (${args.userID})`);
return message.channel.send(`The following user have been blacklisted: ${this.client.users.resolve(args.userID).username}#${this.client.users.resolve(args.userID).discriminator} (${args.userID})`);
} else {
message.channel.send('This user is already blacklisted, do you want to unblacklist him? y/n');
const filter = m => m.content && m.author.id == message.author.id;
@ -41,7 +41,7 @@ class blacklistCommand extends Command {
let messageContent = messages.map(messages => messages.content);
if (messageContent == 'y' || messageContent == 'yes') {
userBlacklist.destroy({where: {userID:args.userID}});
return message.channel.send(`The following user have been unblacklisted: ${this.client.users.get(args.userID).username}#${this.client.users.get(args.userID).discriminator} (${args.userID})`);
return message.channel.send(`The following user have been unblacklisted: ${this.client.users.resolve(args.userID).username}#${this.client.users.resolve(args.userID).discriminator} (${args.userID})`);
}
})
.catch(err => {

View file

@ -1,58 +0,0 @@
const { Command } = require('discord-akairo');
const fs = require('fs');
class censorCommand extends Command {
constructor() {
super('censor', {
aliases: ['censor'],
category: 'owner',
ownerOnly: 'true',
args: [
{
id: 'word',
type: 'string',
match: 'rest'
}
],
description: {
content: 'Censor word for twitter',
usage: '[word]',
examples: ['nigger']
}
});
}
async exec(message, args) {
let word = args.word;
word = word.toLowerCase();
let words = [];
let json = JSON.stringify(words);
fs.readFile('./json/censor.json', 'utf8', function readFileCallback(err, data) {
if (err) {
fs.writeFile('./json/censor.json', `["${word}"]`, function (err) {
if (err) {
console.log(err);
}
});
} else {
words = JSON.parse(data); //now it an object
words.push(word);
json = JSON.stringify(words); //convert it back to json
fs.writeFile('./json/censor.json', json, 'utf8', function (err) {
if (err) {
return console.log(err);
}
});
}
});
return message.channel.send(`censored the word ${word}`);
}
}
module.exports = censorCommand;

View file

@ -31,7 +31,7 @@ class EvalCommand extends Command {
let Attachment = (message.attachments).array();
if (Attachment[0]) {
this.client.users.get(user.id).send(`**Message from the dev:**\n${text}\n**If you wish to respond use the feedback command**`, {files: [Attachment[0].url]})
this.client.users.resolve(user.id).send(`**Message from the dev:**\n${text}\n**If you wish to respond use the feedback command**`, {files: [Attachment[0].url]})
.then(() => {
return message.channel.send(`DM sent to ${user.username}`);
})
@ -40,7 +40,7 @@ class EvalCommand extends Command {
});
}
else {
this.client.users.get(user.id).send(`**Message from the dev:**\n${text}\n**If you wish to respond use the feedback command**`)
this.client.users.resolve(user.id).send(`**Message from the dev:**\n${text}\n**If you wish to respond use the feedback command**`)
.then(() => {
return message.channel.send(`DM sent to ${user.username}`);
})

View file

@ -1,58 +0,0 @@
const { Command } = require('discord-akairo');
const fs = require('fs');
class uncensorCommand extends Command {
constructor() {
super('uncensor', {
aliases: ['uncensor'],
category: 'owner',
ownerOnly: 'true',
args: [
{
id: 'word',
type: 'string',
match: 'rest'
}
],
description: {
content: 'Unensor word for twitter',
usage: '[word]',
examples: ['shit']
}
});
}
async exec(message, args) {
let word = args.word;
word = word.toLowerCase();
let words = [];
let json = JSON.stringify(words);
fs.readFile('./json/uncensor.json', 'utf8', function readFileCallback(err, data) {
if (err) {
fs.writeFile('./json/uncensor.json', `["${word}"]`, function (err) {
if (err) {
console.log(err);
}
});
} else {
words = JSON.parse(data); //now it an object
words.push(word);
json = JSON.stringify(words); //convert it back to json
fs.writeFile('./json/uncensor.json', json, 'utf8', function (err) {
if (err) {
return console.log(err);
}
});
}
});
return message.channel.send(`Uncensored the word ${word}`);
}
}
module.exports = uncensorCommand;

View file

@ -26,7 +26,7 @@ class fartpissCommand extends Command {
}
if (!args.member) {
return message.guild.members.get(message.author.id).setNickname('fart piss')
return message.guild.members.resolve(message.author.id).setNickname('fart piss')
.then(() => message.channel.send('sucessfully fart pissed on you <:youngtroll:488559163832795136>'))
.catch(() => message.channel.send('Sorry i could not fart piss on you :('));
} else {

View file

@ -18,11 +18,11 @@ class aboutCommand extends Command {
async exec(message) {
const Donator = await donator.findAll({order: ['id']});
let description = `This bot is made using [discord.js](https://github.com/discordjs/discord.js) & [Discord-Akairo](https://github.com/discord-akairo/discord-akairo)\nHelp command from [hoshi](https://github.com/1Computer1/hoshi)\n[Rantionary](https://github.com/RantLang/Rantionary) for their dictionnary.\nThanks to ${this.client.users.get('336492042299637771').username}#${this.client.users.get('336492042299637771').discriminator} (336492042299637771) for inspiring me for making this bot!\n\nThe people who donated for the bot <3\n`;
let description = `This bot is made using [discord.js](https://github.com/discordjs/discord.js) & [Discord-Akairo](https://github.com/discord-akairo/discord-akairo)\nHelp command from [hoshi](https://github.com/1Computer1/hoshi)\n[Rantionary](https://github.com/RantLang/Rantionary) for their dictionnary.\nThanks to ${this.client.users.resolve('336492042299637771').username}#${this.client.users.resolve('336492042299637771').discriminator} (336492042299637771) for inspiring me for making this bot!\n\nThe people who donated for the bot <3\n`;
if (Donator[0]) {
for (let i = 0; i < Donator.length; i++) {
description += `**${this.client.users.get(Donator[i].get('userID')).username}#${this.client.users.get(Donator[i].get('userID')).discriminator} (${Donator[i].get('userID')}) | ${Donator[i].get('comment')}**\n`;
description += `**${this.client.users.resolve(Donator[i].get('userID')).username}#${this.client.users.resolve(Donator[i].get('userID')).discriminator} (${Donator[i].get('userID')}) | ${Donator[i].get('comment')}**\n`;
}
} else {
description += 'No one :(';
@ -34,10 +34,10 @@ class aboutCommand extends Command {
.setAuthor(this.client.user.username, this.client.user.avatarURL())
.setTitle('About me')
.setDescription(description)
.addField('Current owner: ', `${this.client.users.get(this.client.ownerID).username}#${this.client.users.get(this.client.ownerID).discriminator} (${this.client.ownerID})`)
.addField('Current owner: ', `${this.client.users.resolve(this.client.ownerID).username}#${this.client.users.resolve(this.client.ownerID).discriminator} (${this.client.ownerID})`)
.addField('Gitlab', 'https://gitlab.com/LoicBersier/DiscordBot', true)
.addField('Github', 'https://github.com/loicbersier/Haha-yes', true)
.setFooter(`Original bot made by ${this.client.users.get('267065637183029248').username}#${this.client.users.get('267065637183029248').discriminator} (267065637183029248)`); // Please don't change the "original bot made by"
.setFooter(`Original bot made by ${this.client.users.resolve('267065637183029248').username}#${this.client.users.resolve('267065637183029248').discriminator} (267065637183029248)`); // Please don't change the "original bot made by"
message.channel.send(aboutEmbed);
}

View file

@ -22,7 +22,7 @@ class donatorCommand extends Command {
if (Donator[0]) {
for (let i = 0; i < Donator.length; i++) {
donatorMessage += `**${this.client.users.get(Donator[i].get('userID')).username}#${this.client.users.get(Donator[i].get('userID')).discriminator} (${Donator[i].get('userID')}) | ${Donator[i].get('comment')}**\n`;
donatorMessage += `**${this.client.users.resolve(Donator[i].get('userID')).username}#${this.client.users.resolve(Donator[i].get('userID')).discriminator} (${Donator[i].get('userID')}) | ${Donator[i].get('comment')}**\n`;
}
} else {
donatorMessage += 'No one :(';

View file

@ -32,7 +32,7 @@ class FeedbackCommand extends Command {
return message.channel.send('Your account is too new to be able to use this command!');
}
const channel = this.client.channels.get(feedbackChannel);
const channel = this.client.channels.resolve(feedbackChannel);
const Embed = this.client.util.embed()
.setAuthor(`${message.author.username} (${message.author.id})`, message.author.displayAvatarURL())

View file

@ -0,0 +1,65 @@
const { Command } = require('discord-akairo');
const captureWebsite = require('capture-website');
const os = require('os');
const fs = require('fs');
class screenshotCommand extends Command {
constructor() {
super('screenshot', {
aliases: ['screenshot', 'webshot', 'ss'],
category: 'utility',
clientPermissions: ['SEND_MESSAGES', 'ATTACH_FILES'],
ownerOnly: 'true', // Owner only until i am sure there is no security issue
args: [
{
id: 'url',
type: 'string'
},
{
id: 'fullpage',
type: 'flag',
flag: '--full'
}
],
channelRestriction: 'guild',
description: {
content: 'Take a screenshot of a website',
usage: '[link to a website]',
examples: ['www.google.com']
}
});
}
async exec(message, args) {
let Embed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setTitle(args.url);
// eslint-disable-next-line no-useless-escape
let urlregex = new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/);
if (args.url.match(urlregex)) { // Only allow link with http/https
await captureWebsite.file(args.url, `${os.tmpdir()}/${message.id}.jpg`, {
type: 'jpeg',
headers: {
'Accept-Language': 'en-GB'
},
fullPage: args.fullpage
})
.catch((err) => {
console.error(err);
Embed.setDescription(err.toString());
return message.channel.send(Embed);
})
.then(() => {
if (fs.existsSync(`${os.tmpdir()}/${message.id}.jpg`)) {
Embed.attachFiles([`${os.tmpdir()}/${message.id}.jpg`]);
Embed.setImage(`attachment://${message.id}.jpg`);
return message.channel.send(Embed);
}
});
} else {
return message.channel.send('The URL you used doesn\'t correspond to a website!');
}
}
}
module.exports = screenshotCommand;

View file

@ -55,9 +55,9 @@ class StatsCommand extends Command {
.setColor(message.member.displayHexColor)
.setTitle('Bot stats')
.setAuthor('Haha yes')
.addField('Servers', this.client.guilds.size, true)
.addField('Channels', this.client.channels.size, true)
.addField('Users', this.client.users.size, true)
.addField('Servers', this.client.guilds.cache.size, true)
.addField('Channels', this.client.channels.cache.size, true)
.addField('Users', this.client.users.cache.size, true)
.addField('Uptime', dateString, true)
.addField('Ram usage', `${Math.round(used * 100) / 100} MB`, true)
.addField('CPU', cpu, true)

View file

@ -31,8 +31,6 @@ class wallpaperCommand extends Command {
return res.json();
})
.then(res => {
console.log(res);
const wallpaperEmbed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setTitle('Bing wallpaper of the day')

View file

@ -9,6 +9,7 @@ class serverblacklistInhibitor extends Inhibitor {
}
async exec(message) {
if (message.channel.type == 'dm') return;
const blacklist = await guildBlacklist.findOne({where: {guildID:message.guild.id}});
if (blacklist) return true;

View file

@ -38,7 +38,7 @@ class CommandBlockedListener extends Listener {
break;
case 'serverblacklist':
Embed.setTitle('Server blacklisted.');
Embed.setDescription(`This server have been blacklisted... to appeal contact ${this.client.users.get(this.client.ownerID).username}#${this.client.users.get(this.client.ownerID).discriminator}, and now i will yeet out of here`);
Embed.setDescription(`This server have been blacklisted... to appeal contact ${this.client.users.resolve(this.client.ownerID).username}#${this.client.users.resolve(this.client.ownerID).discriminator}, and now i will yeet out of here`);
message.channel.send(Embed);
message.guild.leave();
break;

View file

@ -14,7 +14,7 @@ class errorListener extends Listener {
async exec(message, error, command) {
console.log(message);
console.error(`Error happenend on the command: ${command.id}\n${message}\nOn the message: ${error}`);
const channel = this.client.channels.get(errorChannel);
const channel = this.client.channels.resolve(errorChannel);
const errorEmbed = this.client.util.embed()
.setColor('RED')
.setTitle('Shit happened!')

View file

@ -12,7 +12,7 @@ class guildCreateListener extends Listener {
async exec(guild) {
console.log(`${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}`);
const channel = this.client.channels.get(statsChannel);
const channel = this.client.channels.resolve(statsChannel);
const addEmbed = this.client.util.embed()
.setColor('#52e80d')
.setTitle('New boiz in town')
@ -25,7 +25,7 @@ class guildCreateListener extends Listener {
.addField('Number of bots', guild.members.filter(member => member.user.bot).size, true)
.addField('Owner', guild.owner.user.username, true)
.addField('Owner ID', guild.owner.id, true)
.setFooter(`I'm now in ${this.client.guilds.size} servers!`)
.setFooter(`I'm now in ${this.client.guilds.cache.size} servers!`)
.setTimestamp();
channel.send({ embed: addEmbed });

View file

@ -12,7 +12,7 @@ class guildCreateListener extends Listener {
async exec(guild) {
console.log(`***BOT KICKED***\n${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}\n***BOT KICKED***`);
const channel = this.client.channels.get(statsChannel);
const channel = this.client.channels.resolve(statsChannel);
const kickEmbed = this.client.util.embed()
.setColor('#FF0000')
@ -26,7 +26,7 @@ class guildCreateListener extends Listener {
.addField('Number of bots', guild.members.filter(member => member.user.bot).size, true)
.addField('Owner', guild.owner.user.username, true)
.addField('Owner ID', guild.owner.id, true)
.setFooter(`I'm now in ${this.client.guilds.size} servers!`)
.setFooter(`I'm now in ${this.client.guilds.cache.size} servers!`)
.setTimestamp();
channel.send({ embed: kickEmbed });

View file

@ -19,7 +19,7 @@ class guildMemberAddListener extends Listener {
const join = await joinChannel.findOne({where: {guildID: guild.guild.id}});
if (join) {
const channel = this.client.channels.get(join.get('channelID'));
const channel = this.client.channels.resolve(join.get('channelID'));
let welcomeMessage = join.get('message');

View file

@ -13,7 +13,7 @@ class guildMemberRemoveListener extends Listener {
async exec(guild) {
const leave = await leaveChannel.findOne({where: {guildID: guild.guild.id}});
if (leave) {
const channel = this.client.channels.get(leave.get('channelID'));
const channel = this.client.channels.resolve(leave.get('channelID'));
let byeMessage = leave.get('message');

View file

@ -23,11 +23,10 @@ class MessageReactionAddListener extends Listener {
let reactionCount = reaction.count;
// If one of the reaction is the author of the message remove 1 to the reaction count
reaction.users.forEach(user => {
reaction.users.cache.forEach(user => {
if (reaction.message.author == user) reactionCount--;
});
// Starboard
if (fs.existsSync(`./board/star${reaction.message.guild.id}.json`)) {
starboardChannel = require(`../../board/star${reaction.message.guild.id}.json`);
@ -36,11 +35,11 @@ class MessageReactionAddListener extends Listener {
delete require.cache[require.resolve(`../../board/star${reaction.message.guild.id}.json`)]; // Delete the boardChannel cache so it can reload it next time
// Get name of the custom emoji
if (this.client.util.resolveEmoji(staremote, reaction.message.guild.emojis)) {
staremote = this.client.util.resolveEmoji(staremote, reaction.message.guild.emojis).name;
if (reaction.message.guild.emojis.resolve(staremote.replace(/\D/g,''))) {
staremote = reaction.message.guild.emojis.resolve(staremote.replace(/\D/g,''));
}
if (reaction.emoji.name == staremote) {
if (reaction.emoji == staremote || reaction.emoji.name == staremote) {
if (messageID[reaction.message.id] && reactionCount > starcount) {
return editEmbed('starboard', staremote, messageID[reaction.message.id], this.client);
} else if (reactionCount == starcount) {
@ -57,11 +56,11 @@ class MessageReactionAddListener extends Listener {
delete require.cache[require.resolve(`../../board/shame${reaction.message.guild.id}.json`)]; // Delete the boardChannel cache so it can reload it next time
// Get name of the custom emoji
if (this.client.util.resolveEmoji(shameemote, reaction.message.guild.emojis)) {
shameemote = this.client.util.resolveEmoji(shameemote, reaction.message.guild.emojis).name;
if (reaction.message.guild.emojis.resolve(shameemote.replace(/\D/g,''))) {
shameemote = reaction.message.guild.emojis.resolve(shameemote.replace(/\D/g,''));
}
if (reaction.emoji.name == shameemote) {
if (reaction.emoji == shameemote || reaction.emoji.name == shameemote) {
if (messageID[reaction.message.id] && reactionCount > shamecount) {
return editEmbed('shameboard', shameemote, messageID[reaction.message.id], this.client);
} else if (reactionCount == shamecount) {
@ -73,12 +72,12 @@ class MessageReactionAddListener extends Listener {
async function editEmbed(name, emote, boardID, client) {
let channel;
if (name == 'starboard') {
channel = client.channels.get(starboardChannel.starboard);
channel = client.channels.resolve(starboardChannel.starboard);
} else {
channel = client.channels.get(shameboardChannel.shameboard);
channel = client.channels.resolve(shameboardChannel.shameboard);
}
let message = await channel.messages.get(boardID);
let message = await channel.messages.resolve(boardID);
// If the message doesn't have embeds assume it got deleted so don't do anything
if (!message) return;
@ -94,12 +93,10 @@ class MessageReactionAddListener extends Listener {
.addField('Jump to', `[message](https://discordapp.com/channels/${reaction.message.guild.id}/${reaction.message.channel.id}/${reaction.message.id})`, true)
.addField('Channel', reaction.message.channel, true)
.setDescription(description)
.setFooter(reactionCount + ' ' + emote)
.setFooter(`${emote} ${reactionCount}`)
.setTimestamp();
if (reaction.message.guild.emojis.find(emoji => emoji.name === emote)) {
Embed.setFooter(reactionCount, reaction.message.guild.emojis.find(emoji => emoji.name === emote).url);
}
if (reaction.message.guild.emojis.resolve(emote)) Embed.setFooter(reactionCount, reaction.message.guild.emojis.resolve(emote).url);
message.edit({ embed: Embed });
}
@ -109,9 +106,9 @@ class MessageReactionAddListener extends Listener {
// Should change this so it automatically pic the channel ( I'm lazy right now )
let channel;
if (name == 'starboard') {
channel = client.channels.get(starboardChannel.starboard);
channel = client.channels.resolve(starboardChannel.starboard);
} else {
channel = client.channels.get(shameboardChannel.shameboard);
channel = client.channels.resolve(shameboardChannel.shameboard);
}
let Embed = client.util.embed()
@ -119,17 +116,14 @@ class MessageReactionAddListener extends Listener {
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL())
.addField('Jump to', `[message](https://discordapp.com/channels/${reaction.message.guild.id}/${reaction.message.channel.id}/${reaction.message.id})`, true)
.addField('Channel', reaction.message.channel, true)
.setFooter(reactionCount + ' ' + emote)
.setFooter(`${emote} ${reactionCount}`)
.setTimestamp();
if (reaction.message.guild.emojis.find(emoji => emoji.name === emote)) {
Embed.setFooter(reactionCount, reaction.message.guild.emojis.find(emoji => emoji.name === emote).url);
}
if (reaction.message.guild.emojis.resolve(emote)) Embed.setFooter(reactionCount, reaction.message.guild.emojis.resolve(emote).url);
let description = '';
if (reaction.message.embeds[0]) {
console.log(reaction.message.embeds[0].url);
if (reaction.message.embeds[0].type == 'image') {
messageAttachments = reaction.message.embeds[0].url;
}

View file

@ -22,7 +22,7 @@ class messageReactionRemoveListener extends Listener {
let reactionCount = reaction.count;
// If one of the reaction removed is the author of the message add 1 to the reaction count
reaction.users.forEach(user => {
reaction.users.cache.forEach(user => {
if (reaction.message.author == user) reactionCount++;
});
@ -33,19 +33,20 @@ class messageReactionRemoveListener extends Listener {
let starcount = starboardChannel.count;
delete require.cache[require.resolve(`../../board/star${reaction.message.guild.id}.json`)]; // Delete the boardChannel cache so it can reload it next time
if (this.client.util.resolveEmoji(staremote, reaction.message.guild.emojis)) {
staremote = this.client.util.resolveEmoji(staremote, reaction.message.guild.emojis).name;
// Get name of the custom emoji
if (reaction.message.guild.emojis.resolve(staremote.replace(/\D/g,''))) {
staremote = reaction.message.guild.emojis.resolve(staremote.replace(/\D/g,''));
}
if (messageID[reaction.message.id] && reaction.emoji.name == staremote && reactionCount < starcount) {
let channel = this.client.channels.get(starboardChannel.starboard);
let message = await channel.messages.get(messageID[reaction.message.id]);
if (messageID[reaction.message.id] && (reaction.emoji == staremote || reaction.emoji.name == staremote) && reactionCount < starcount) {
let channel = this.client.channels.resolve(starboardChannel.starboard);
let message = await channel.messages.resolve(messageID[reaction.message.id]);
delete messageID[reaction.message.id];
// If it didn't find any message don't do anything
if (!message) return;
message.delete();
} else if (reaction.emoji.name == staremote && reactionCount >= starcount) {
} else if ((reaction.emoji == staremote || reaction.emoji.name == staremote) && reactionCount >= starcount) {
return editEmbed('starboard', staremote, messageID[reaction.message.id], this.client);
}
}
@ -57,16 +58,17 @@ class messageReactionRemoveListener extends Listener {
let shamecount = shameboardChannel.count;
delete require.cache[require.resolve(`../../board/shame${reaction.message.guild.id}.json`)]; // Delete the boardChannel cache so it can reload it next time
if (this.client.util.resolveEmoji(shameemote, reaction.message.guild.emojis)) {
shameemote = this.client.util.resolveEmoji(shameemote, reaction.message.guild.emojis).name;
// Get name of the custom emoji
if (reaction.message.guild.emojis.resolve(shameemote.replace(/\D/g,''))) {
shameemote = reaction.message.guild.emojis.resolve(shameemote.replace(/\D/g,''));
}
if (messageID[reaction.message.id] && reaction.emoji.name == shameemote && reactionCount < shamecount) {
let channel = this.client.channels.get(shameboardChannel.shameboard);
let message = await channel.messages.get(messageID[reaction.message.id]);
if (messageID[reaction.message.id] && (reaction.emoji == shameemote || reaction.emoji.name == shameemote) && reactionCount < shamecount) {
let channel = this.client.channels.resolve(shameboardChannel.shameboard);
let message = await channel.messages.resolve(messageID[reaction.message.id]);
delete messageID[reaction.message.id];
message.delete();
} else if (reaction.emoji.name == shameemote && reactionCount >= shamecount) {
} else if ((reaction.emoji == shameemote || reaction.emoji.name == shameemote) && reactionCount >= shamecount) {
return editEmbed('shameboard', shameemote, messageID[reaction.message.id], this.client);
}
}
@ -74,19 +76,19 @@ class messageReactionRemoveListener extends Listener {
async function editEmbed(name, emote, boardID, client) {
let channel;
if (name == 'starboard') {
channel = client.channels.get(starboardChannel.starboard);
channel = client.channels.resolve(starboardChannel.starboard);
} else {
channel = client.channels.get(shameboardChannel.shameboard);
channel = client.channels.resolve(shameboardChannel.shameboard);
}
let message = await channel.messages.get(boardID);
let message = await channel.messages.resolve(boardID);
// If the message doesn't have embeds assume it got deleted so don't do anything
if (!message) return;
// If the original embed description is empty make this embed empty ( and not undefined )
let description = message.embeds[0].description;
if (!message.embeds[0].description)
if (!message.embeds[0].description || message.embeds[0].description == undefined)
description = '';
let Embed = client.util.embed()
@ -95,12 +97,10 @@ class messageReactionRemoveListener extends Listener {
.addField('Jump to', `[message](https://discordapp.com/channels/${reaction.message.guild.id}/${reaction.message.channel.id}/${reaction.message.id})`, true)
.addField('Channel', reaction.message.channel, true)
.setDescription(description)
.setFooter(reactionCount + ' ' + emote)
.setFooter(`${emote} ${reactionCount}`)
.setTimestamp();
if (reaction.message.guild.emojis.find(emoji => emoji.name === emote)) {
Embed.setFooter(reactionCount, reaction.message.guild.emojis.find(emoji => emoji.name === emote).url);
}
if (reaction.message.guild.emojis.resolve(emote)) Embed.setFooter(reactionCount, reaction.message.guild.emojis.resolve(emote).url);
message.edit({ embed: Embed });
}

View file

@ -18,12 +18,13 @@ class ReadyListener extends Listener {
async exec() {
let commandSize = this.client.commandHandler.modules.size;
let clientTag = this.client.user.tag;
let guildSize = this.client.guilds.size;
let userSize = this.client.users.size;
let channelSize = this.client.channels.size;
let guildSize = this.client.guilds.cache.size;
let userSize = this.client.users.cache.size;
let channelSize = this.client.channels.cache.size;
let profilePicture = this.client.user.displayAvatarURL();
let clientID = this.client.user.id;
let author = this.client.users.get(ownerID).tag;
let author = this.client.users.resolve(ownerID).tag;
// Send stats to the console
console.log('===========[ READY ]===========');
@ -40,7 +41,7 @@ class ReadyListener extends Listener {
}, 1800000);
async function setStatus(client) {
let owner = client.users.get(client.ownerID);
let owner = client.users.resolve(client.ownerID);
let random = Math.floor((Math.random() * 3));
if (random == 0) { // Random "Watching" status taken from json
console.log('Status type: \x1b[32mWatching\x1b[0m');
@ -56,38 +57,38 @@ class ReadyListener extends Listener {
status = status.replace('${prefix}', prefix[0]);
client.user.setActivity(`${status} | My prefix is: ${prefix[0]}`, { type: 'PLAYING' });
} else if (random == 2 && owner.presence.activity != null) { // Bot owner status
} else if (random == 2 && owner.presence.activities != null) { // Bot owner status
console.log('Status type: \x1b[32mCopying owner status\x1b[0m');
// Get elapsed time from when the activity started
let diffMins = 0;
if (owner.presence.activity.timestamps) {
let diffMs = (new Date() - owner.presence.activity.timestamps.start);
if (owner.presence.activities[0].timestamps) {
let diffMs = (new Date() - owner.presence.activities[0].timestamps.start);
diffMins = Math.round(((diffMs % 86400000) % 3600000) / 60000);
}
client.user.setActivity(`${owner.presence.activity.name}\nfor ${diffMins} minutes | My prefix is: ${prefix[0]}`, owner.presence.activity);
client.user.setActivity(`${owner.presence.activities[0].name}\nfor ${diffMins} minutes | My prefix is: ${prefix[0]}`, owner.presence.activities[0]);
} else { // Random user statuss
console.log('Status type: \x1b[32mCopying random user status\x1b[0m');
let randomuser = client.users.random();
// If the random user have no activity or is a bot pick a new user
while (randomuser.presence.activity == null || randomuser.presence.activity.type == 'CUSTOM_STATUS' || randomuser.bot) {
while (randomuser.presence.activities[0] == null || randomuser.presence.activities[0].type == 'CUSTOM_STATUS' || randomuser.bot) {
randomuser = client.users.random();
}
// Get elapsed time from when the activity started
let diffMins = 0;
if (randomuser.presence.activity.timestamps) {
let diffMs = (new Date() - randomuser.presence.activity.timestamps.start);
if (randomuser.presence.activities[0].timestamps) {
let diffMs = (new Date() - randomuser.presence.activities[0].timestamps.start);
diffMins = Math.round(((diffMs % 86400000) % 3600000) / 60000);
}
client.user.setActivity(`${randomuser.username} is ${randomuser.presence.activity.type.toLowerCase()} ${randomuser.presence.activity.name}\nfor ${diffMins} minutes | My prefix is: ${prefix[0]}`, { type: randomuser.presence.activity.type, url: randomuser.presence.activity.url, name: randomuser.presence.activity.name });
client.user.setActivity(`${randomuser.username} is ${randomuser.presence.activities[0].type.toLowerCase()} ${randomuser.presence.activities[0].name}\nfor ${diffMins} minutes | My prefix is: ${prefix[0]}`, { type: randomuser.presence.activities[0].type, url: randomuser.presence.activities[0].url, name: randomuser.presence.activities[0].name });
}
}
// If stats channel settings exist, send bot stats to it
if (statsChannel) {
const channel = this.client.channels.get(statsChannel);
const channel = this.client.channels.resolve(statsChannel);
channel.send(`Ready to serve in ${channelSize} channels on ${guildSize} servers, for a total of ${userSize} users.\nThere is ${commandSize} command loaded\n${this.client.readyAt}`);
}
@ -100,8 +101,8 @@ class ReadyListener extends Listener {
const requestHandler = (req, res) => {
// Refresh some info
commandSize = this.client.commandHandler.modules.size;
guildSize = this.client.guilds.size;
userSize = this.client.users.size;
guildSize = this.client.guilds.cache.size;
userSize = this.client.users.cache.size;
profilePicture = this.client.user.displayAvatarURL();
let response = {

362
package-lock.json generated
View file

@ -64,9 +64,9 @@
}
},
"@discordjs/collection": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.3.tgz",
"integrity": "sha512-4ek19SmNcPI92942RkuBrZrBK8hg7nG+ae/skkNNDeOaUG+XvxTPkv/jPZVgXwVPDkU5EFsewsI+0n4dTwFvgA=="
"version": "0.1.5",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.5.tgz",
"integrity": "sha512-CU1q0UXQUpFNzNB7gufgoisDHP7n+T3tkqTsp3MNUkVJ5+hS3BCvME8uCXAUFlz+6T2FbTCu75A+yQ7HMKqRKw=="
},
"@google-cloud/text-to-speech": {
"version": "0.4.0",
@ -618,6 +618,11 @@
"resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.0.tgz",
"integrity": "sha512-1w52Nyx4Gq47uuu0EVcsHBxZFJgurQ+rTKS3qMHxR1GY2T8c2AJYd6vZoZ9q1rupaDjU0yT+Jc2XTyXkjeMA+Q=="
},
"@types/mime-types": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.0.tgz",
"integrity": "sha1-nKUs2jY/aZxpRmwqbM2q2RPqenM="
},
"@types/node": {
"version": "9.6.48",
"resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.48.tgz",
@ -797,32 +802,33 @@
"integrity": "sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4="
},
"array-includes": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.0.tgz",
"integrity": "sha512-ONOEQoKrvXPKk7Su92Co0YMqYO32FfqJTzkKU9u2UpIXyYZIzLSvpdg4AwvSw4mSUW0czu6inK+zby6Oj6gDjQ==",
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.1.tgz",
"integrity": "sha512-c2VXaCHl7zPsvpkFsw4nxvFie4fh1ur9bpcgsVkIjqn0H/Xwdg+7fv3n2r/isyS8EBj5b06M9kHyZuIr4El6WQ==",
"dev": true,
"requires": {
"define-properties": "^1.1.3",
"es-abstract": "^1.17.0-next.0"
"es-abstract": "^1.17.0",
"is-string": "^1.0.5"
},
"dependencies": {
"es-abstract": {
"version": "1.17.0-next.1",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.0-next.1.tgz",
"integrity": "sha512-7MmGr03N7Rnuid6+wyhD9sHNE2n4tFSwExnU2lQl3lIo2ShXWGePY80zYaoMOmILWv57H0amMjZGHNzzGG70Rw==",
"version": "1.17.4",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.4.tgz",
"integrity": "sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ==",
"dev": true,
"requires": {
"es-to-primitive": "^1.2.1",
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.1",
"is-callable": "^1.1.4",
"is-regex": "^1.0.4",
"is-callable": "^1.1.5",
"is-regex": "^1.0.5",
"object-inspect": "^1.7.0",
"object-keys": "^1.1.1",
"object.assign": "^4.1.0",
"string.prototype.trimleft": "^2.1.0",
"string.prototype.trimright": "^2.1.0"
"string.prototype.trimleft": "^2.1.1",
"string.prototype.trimright": "^2.1.1"
}
},
"es-to-primitive": {
@ -841,6 +847,21 @@
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
"integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==",
"dev": true
},
"is-callable": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz",
"integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==",
"dev": true
},
"is-regex": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz",
"integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==",
"dev": true,
"requires": {
"has": "^1.0.3"
}
}
}
},
@ -878,22 +899,22 @@
},
"dependencies": {
"es-abstract": {
"version": "1.17.0-next.1",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.0-next.1.tgz",
"integrity": "sha512-7MmGr03N7Rnuid6+wyhD9sHNE2n4tFSwExnU2lQl3lIo2ShXWGePY80zYaoMOmILWv57H0amMjZGHNzzGG70Rw==",
"version": "1.17.4",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.4.tgz",
"integrity": "sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ==",
"dev": true,
"requires": {
"es-to-primitive": "^1.2.1",
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.1",
"is-callable": "^1.1.4",
"is-regex": "^1.0.4",
"is-callable": "^1.1.5",
"is-regex": "^1.0.5",
"object-inspect": "^1.7.0",
"object-keys": "^1.1.1",
"object.assign": "^4.1.0",
"string.prototype.trimleft": "^2.1.0",
"string.prototype.trimright": "^2.1.0"
"string.prototype.trimleft": "^2.1.1",
"string.prototype.trimright": "^2.1.1"
}
},
"es-to-primitive": {
@ -912,6 +933,21 @@
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
"integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==",
"dev": true
},
"is-callable": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz",
"integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==",
"dev": true
},
"is-regex": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz",
"integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==",
"dev": true,
"requires": {
"has": "^1.0.3"
}
}
}
},
@ -1270,6 +1306,33 @@
}
}
},
"capture-website": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/capture-website/-/capture-website-0.8.1.tgz",
"integrity": "sha512-2fcVq/Z2epiZld5sSvMqw9vFo2OxHrC2ryqRB0Nwh61Q72W+eBd/4M+StSqBGSErRlP1N/FkBpBT6IUtDr8MZQ==",
"requires": {
"file-url": "^3.0.0",
"puppeteer": "^2.0.0",
"tough-cookie": "^3.0.1"
},
"dependencies": {
"ip-regex": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz",
"integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk="
},
"tough-cookie": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz",
"integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==",
"requires": {
"ip-regex": "^2.1.0",
"psl": "^1.1.28",
"punycode": "^2.1.1"
}
}
}
},
"cardinal": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/cardinal/-/cardinal-1.0.0.tgz",
@ -2097,21 +2160,33 @@
}
},
"discord-akairo": {
"version": "github:1Computer1/discord-akairo#563d57b428ab7dfee3cdedf04834f6d3d606481e",
"version": "github:1Computer1/discord-akairo#10cef7efc7a329cb1e0d96d73ccb4b83bc0afa72",
"from": "github:1Computer1/discord-akairo#master"
},
"discord.js": {
"version": "github:discordjs/discord.js#45b89710008d207da22000dcb633c0c0236db17e",
"version": "github:discordjs/discord.js#bfcd4befc9a6d56c4c7db5c736bd7f31524f097c",
"from": "github:discordjs/discord.js#master",
"requires": {
"@discordjs/collection": "^0.1.1",
"@discordjs/collection": "^0.1.5",
"abort-controller": "^3.0.0",
"form-data": "^2.3.3",
"node-fetch": "^2.3.0",
"prism-media": "^1.0.0",
"form-data": "^3.0.0",
"node-fetch": "^2.6.0",
"prism-media": "^1.2.0",
"setimmediate": "^1.0.5",
"tweetnacl": "^1.0.1",
"ws": "^7.2.0"
"tweetnacl": "^1.0.3",
"ws": "^7.2.1"
},
"dependencies": {
"form-data": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz",
"integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
}
}
},
"doctrine": {
@ -2467,13 +2542,13 @@
"dev": true
},
"eslint-import-resolver-node": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz",
"integrity": "sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==",
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.3.tgz",
"integrity": "sha512-b8crLDo0M5RSe5YG8Pu2DYBj71tSB6OvXkfzwbJU2w7y8P4/yo0MyF8jU26IEuEuHF2K5/gcAJE3LhQGqBBbVg==",
"dev": true,
"requires": {
"debug": "^2.6.9",
"resolve": "^1.5.0"
"resolve": "^1.13.1"
},
"dependencies": {
"debug": {
@ -2490,13 +2565,22 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
},
"resolve": {
"version": "1.15.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz",
"integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
}
}
}
},
"eslint-module-utils": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.5.0.tgz",
"integrity": "sha512-kCo8pZaNz2dsAW7nCUjuVoI11EBXXpIzfNxmaoLhXoRDOnqXLC4iSGVRdZPhOitfbdEfMEfKOiENaK6wDPZEGw==",
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.5.2.tgz",
"integrity": "sha512-LGScZ/JSlqGKiT8OC+cYRxseMjyqt6QO54nl281CK93unD89ijSeRV6An8Ci/2nvWVKe8K/Tqdm75RQoIOCr+Q==",
"dev": true,
"requires": {
"debug": "^2.6.9",
@ -2531,9 +2615,9 @@
}
},
"eslint-plugin-import": {
"version": "2.19.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.19.1.tgz",
"integrity": "sha512-x68131aKoCZlCae7rDXKSAQmbT5DQuManyXo2sK6fJJ0aK5CWAkv6A6HJZGgqC8IhjQxYPgo6/IY4Oz8AFsbBw==",
"version": "2.20.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.20.1.tgz",
"integrity": "sha512-qQHgFOTjguR+LnYRoToeZWT62XM55MBVXObHM6SKFd1VzDcX/vqT1kAz8ssqigh5eMj8qXcRoXXGZpPP6RfdCw==",
"dev": true,
"requires": {
"array-includes": "^3.0.3",
@ -2633,9 +2717,9 @@
}
},
"resolve": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.13.1.tgz",
"integrity": "sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w==",
"version": "1.15.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz",
"integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
@ -2823,6 +2907,48 @@
"tmp": "^0.0.33"
}
},
"extract-zip": {
"version": "1.6.7",
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz",
"integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=",
"requires": {
"concat-stream": "1.6.2",
"debug": "2.6.9",
"mkdirp": "0.5.1",
"yauzl": "2.4.1"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"requires": {
"ms": "2.0.0"
}
},
"fd-slicer": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz",
"integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=",
"requires": {
"pend": "~1.2.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"yauzl": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz",
"integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=",
"requires": {
"fd-slicer": "~1.0.1"
}
}
}
},
"extsprintf": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
@ -2905,6 +3031,11 @@
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
},
"file-url": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/file-url/-/file-url-3.0.0.tgz",
"integrity": "sha512-g872QGsHexznxkIAdK8UiZRe7SkE6kvylShU4Nsj8NvfvZag7S0QuQ4IgvPDkk75HxgjIVDwycFTDAgIiO4nDA=="
},
"find-replace": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz",
@ -4260,6 +4391,12 @@
"resolved": "https://registry.npmjs.org/is-stream-ended/-/is-stream-ended-0.1.4.tgz",
"integrity": "sha512-xj0XPvmr7bQFTvirqnFr50o0hQIh6ZItDqloxt5aJrR4NQsYeSsyFQERYGCAzfindAcnKjINnwEEgLx4IqVzQw=="
},
"is-string": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz",
"integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==",
"dev": true
},
"is-subset": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/is-subset/-/is-subset-0.1.1.tgz",
@ -4796,9 +4933,9 @@
"integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
},
"moment-timezone": {
"version": "0.5.27",
"resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.27.tgz",
"integrity": "sha512-EIKQs7h5sAsjhPCqN6ggx6cEbs94GK050254TIJySD1bzoM5JTYDwAU1IoVOeTOL6Gm27kYJ51/uuvq1kIlrbw==",
"version": "0.5.28",
"resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.28.tgz",
"integrity": "sha512-TDJkZvAyKIVWg5EtVqRzU97w0Rb0YVbfpqyjgu6GwXCAohVRqwZjf4fOzDE6p1Ch98Sro/8hQQi65WDXW5STPw==",
"requires": {
"moment": ">= 2.9.0"
}
@ -5164,22 +5301,22 @@
},
"dependencies": {
"es-abstract": {
"version": "1.17.0-next.1",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.0-next.1.tgz",
"integrity": "sha512-7MmGr03N7Rnuid6+wyhD9sHNE2n4tFSwExnU2lQl3lIo2ShXWGePY80zYaoMOmILWv57H0amMjZGHNzzGG70Rw==",
"version": "1.17.4",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.4.tgz",
"integrity": "sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ==",
"dev": true,
"requires": {
"es-to-primitive": "^1.2.1",
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.1",
"is-callable": "^1.1.4",
"is-regex": "^1.0.4",
"is-callable": "^1.1.5",
"is-regex": "^1.0.5",
"object-inspect": "^1.7.0",
"object-keys": "^1.1.1",
"object.assign": "^4.1.0",
"string.prototype.trimleft": "^2.1.0",
"string.prototype.trimright": "^2.1.0"
"string.prototype.trimleft": "^2.1.1",
"string.prototype.trimright": "^2.1.1"
}
},
"es-to-primitive": {
@ -5198,6 +5335,21 @@
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
"integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==",
"dev": true
},
"is-callable": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz",
"integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==",
"dev": true
},
"is-regex": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz",
"integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==",
"dev": true,
"requires": {
"has": "^1.0.3"
}
}
}
},
@ -5582,9 +5734,9 @@
"integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc="
},
"prism-media": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.1.0.tgz",
"integrity": "sha512-W+oxjRyjtd7hw3pefNZuc7YEZ6VICORJvVNfCPs0+7CsJ43CqMjGAYGjPL3hQ82vw03EVra+CiX4zisqOBUUGw=="
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.2.1.tgz",
"integrity": "sha512-R3EbKwJiYlTvGwcG1DpUt+06DsxOGS5W4AMEHT7oVOjG93MjpdhGX1whHyjnqknylLMupKAsKMEXcTNRbPe6Vw=="
},
"process": {
"version": "0.5.2",
@ -5599,8 +5751,7 @@
"progress": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
"integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",
"dev": true
"integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA=="
},
"proto-list": {
"version": "1.2.4",
@ -5639,6 +5790,11 @@
"resolved": "https://registry.npmjs.org/protocols/-/protocols-1.4.7.tgz",
"integrity": "sha512-Fx65lf9/YDn3hUX08XUc0J8rSux36rEsyiv21ZGUC1mOyeM3lTRpZLcrm8aAolzS4itwVfm7TAPyxC2E5zd6xg=="
},
"proxy-from-env": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz",
"integrity": "sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4="
},
"pseudomap": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
@ -5663,6 +5819,68 @@
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
},
"puppeteer": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-2.1.1.tgz",
"integrity": "sha512-LWzaDVQkk1EPiuYeTOj+CZRIjda4k2s5w4MK4xoH2+kgWV/SDlkYHmxatDdtYrciHUKSXTsGgPgPP8ILVdBsxg==",
"requires": {
"@types/mime-types": "^2.1.0",
"debug": "^4.1.0",
"extract-zip": "^1.6.6",
"https-proxy-agent": "^4.0.0",
"mime": "^2.0.3",
"mime-types": "^2.1.25",
"progress": "^2.0.1",
"proxy-from-env": "^1.0.0",
"rimraf": "^2.6.1",
"ws": "^6.1.0"
},
"dependencies": {
"agent-base": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz",
"integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g=="
},
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
},
"https-proxy-agent": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz",
"integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==",
"requires": {
"agent-base": "5",
"debug": "4"
}
},
"mime-db": {
"version": "1.43.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz",
"integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ=="
},
"mime-types": {
"version": "2.1.26",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz",
"integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==",
"requires": {
"mime-db": "1.43.0"
}
},
"ws": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
"integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
"requires": {
"async-limiter": "~1.0.0"
}
}
}
},
"q": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",
@ -6156,9 +6374,9 @@
"integrity": "sha1-1WgS4cAXpuTnw+Ojeh2m143TyT4="
},
"sequelize": {
"version": "5.21.3",
"resolved": "https://registry.npmjs.org/sequelize/-/sequelize-5.21.3.tgz",
"integrity": "sha512-ptdeAxwTY0zbj7AK8m+SH3z52uHVrt/qmOTSIGo/kyfnSp3h5HeKlywkJf5GEk09kuRrPHfWARVSXH1W3IGU7g==",
"version": "5.21.5",
"resolved": "https://registry.npmjs.org/sequelize/-/sequelize-5.21.5.tgz",
"integrity": "sha512-n9hR5K4uQGmBGK/Y/iqewCeSFmKVsd0TRnh0tfoLoAkmXbKC4tpeK96RhKs7d+TTMtrJlgt2TNLVBaAxEwC4iw==",
"requires": {
"bluebird": "^3.5.0",
"cls-bluebird": "^2.1.0",
@ -6191,9 +6409,9 @@
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
},
"uuid": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
}
}
},
@ -6467,9 +6685,9 @@
}
},
"string.prototype.trimleft": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz",
"integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.1.tgz",
"integrity": "sha512-iu2AGd3PuP5Rp7x2kEZCrB2Nf41ehzh+goo8TV7z8/XDBbsvc6HQIlUl9RjkZ4oyrW1XM5UwlGl1oVEaDjg6Ag==",
"dev": true,
"requires": {
"define-properties": "^1.1.3",
@ -6477,9 +6695,9 @@
}
},
"string.prototype.trimright": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz",
"integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.1.tgz",
"integrity": "sha512-qFvWL3/+QIgZXVmJBfpHmxLB7xsUXz6HsUmP8+5dRaC3Q7oKUv9Vo6aMCRZC1smrtyECFsIT30PqBJ1gTjAs+g==",
"dev": true,
"requires": {
"define-properties": "^1.1.3",
@ -6896,9 +7114,9 @@
}
},
"tweetnacl": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.1.tgz",
"integrity": "sha512-kcoMoKTPYnoeS50tzoqjPY3Uv9axeuuFAZY9M/9zFnhoVvRfxz9K29IMPD7jGmt2c8SW7i3gT9WqDl2+nV7p4A=="
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz",
"integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw=="
},
"twit": {
"version": "2.2.11",

View file

@ -1,6 +1,6 @@
{
"name": "hahayes",
"version": "2.1.0",
"version": "3.0.0",
"main": "index.js",
"dependencies": {
"4chan-boards": "^2.0.1",
@ -8,6 +8,7 @@
"asciify-image": "^0.1.5",
"bufferutil": "^4.0.1",
"canvas": "^2.6.0",
"capture-website": "^0.8.1",
"console-stamp": "^0.2.9",
"discord-akairo": "github:1Computer1/discord-akairo#master",
"discord.js": "github:discordjs/discord.js#master",
@ -24,7 +25,7 @@
"mysql2": "^1.7.0",
"node-fetch": "^2.6.0",
"node-opus": "^0.3.3",
"sequelize": "^5.21.1",
"sequelize": "^5.21.5",
"sqlite3": "^4.1.0",
"superagent": "^4.1.0",
"turndown": "^5.0.3",
@ -38,7 +39,7 @@
"devDependencies": {
"eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1"

View file

@ -20,8 +20,8 @@ exports.random = function (text, message) {
do {
if (message) {
text = text.replace(/\[author\]/, message.author.username);
text = text.replace(/\[member\]/g, message.guild.members.random().user.username);
text = text.replace(/\[memberRand\]/, message.guild.members.random().user.username);
text = text.replace(/\[member\]/g, message.guild.members.cache.random().user.username);
text = text.replace(/\[memberRand\]/, message.guild.members.cache.random().user.username);
}
text = text.replace(/\[number\]/, Math.floor((Math.random() * 9) + 1));
text = text.replace(/\[kick\]/, ' ');