Use discord-akairo embed

This commit is contained in:
loicbersier 2019-11-22 12:30:20 +01:00
parent 67a4bc0ef8
commit 8b889c7210
24 changed files with 31 additions and 55 deletions

View file

@ -1,5 +1,4 @@
const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
const fetch = require('node-fetch');
const boards = require('4chan-boards');
const htmlToText = require('html-to-text');
@ -62,7 +61,7 @@ class FourchanCommand extends Command {
title = 'No title';
}
const FourchanEmbed = new MessageEmbed()
const FourchanEmbed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setTitle(title)
.setDescription(htmlToText.fromString(description))

View file

@ -1,5 +1,4 @@
const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
const fetch = require('node-fetch');
class RedditCommand extends Command {
@ -43,7 +42,7 @@ class RedditCommand extends Command {
let i = Math.floor((Math.random() * response.data.children.length));
if (response.data.children[i].data.over_18 == true && !message.channel.nsfw)
return message.channel.send('No nsfw');
const redditEmbed = new MessageEmbed()
const redditEmbed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setTitle(response.data.children[i].data.title)
.setDescription(response.data.children[i].data.selftext)

View file

@ -1,5 +1,4 @@
const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
const fetch = require('node-fetch');
class AdviceCommand extends Command {
@ -20,7 +19,7 @@ class AdviceCommand extends Command {
fetch('http://api.adviceslip.com/advice').then((response) => {
return response.json();
}).then((response) => {
const adviceEmbed = new MessageEmbed()
const adviceEmbed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setTitle(response.slip.slip_id)
.setDescription(response.slip.advice);

View file

@ -1,5 +1,4 @@
const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
const rand = require('../../rand.js');
class SayCommand extends Command {
@ -130,7 +129,7 @@ class SayCommand extends Command {
}
}
const embed = new MessageEmbed()
const embed = this.client.util.embed()
.setColor(color)
.setTitle(title)
.setImage(image)

View file

@ -1,7 +1,6 @@
const { Command } = require('discord-akairo');
const Twitter = require('twitter-lite');
const rand = require('../../rand.js');
const { MessageEmbed } = require('discord.js');
//const Filter = require('bad-words');
//let filter = new Filter();
const TwitterBlacklist = require('../../models').TwitterBlacklist;
@ -84,7 +83,7 @@ class tweetCommand extends Command {
const tweetid = response.id_str;
const publicEmbed = new MessageEmbed()
const publicEmbed = this.client.util.embed()
.setAuthor('Some user of discord said...')
.setDescription(args.text)
.addField('Link', `https://twitter.com/HahaYesDB/status/${tweetid}`)
@ -94,7 +93,7 @@ class tweetCommand extends Command {
let channel = this.client.channels.get('597964498921455637');
channel.send({embed: publicEmbed});
const Embed = new MessageEmbed()
const Embed = this.client.util.embed()
.setAuthor(message.author.username, message.author.displayAvatarURL())
.setDescription(args.text)
.addField('Link', `https://twitter.com/HahaYesDB/status/${tweetid}`, true)

View file

@ -2,7 +2,6 @@
// Higher the level the less time you have to complete it
// Make the command less shit
const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
const borgar = require('../../models').borgar;
class borgarCommand extends Command {
@ -57,7 +56,7 @@ class borgarCommand extends Command {
hamIngredient.push('bun');
let borgarEmbed = new MessageEmbed()
let borgarEmbed = this.client.util.embed()
.setTitle('hamborger info')
.setDescription(`could you do me an **amborgar** that contain **${hamIngredient}**`)
.setFooter(`Level ${level} | Once the ingredients dissapear you have 10 seconds to do it!`)
@ -66,7 +65,7 @@ class borgarCommand extends Command {
message.util.send(borgarEmbed)
.then(() => {
setTimeout(async () => {
borgarEmbed = new MessageEmbed()
borgarEmbed = this.client.util.embed()
.setTitle('hamborger delivery')
.setDescription('You have to put each ingredients in seperate messages!')
.setFooter(`Level ${level} | you have 10 seconds to make that hamborgor`)

View file

@ -1,6 +1,5 @@
const { Command } = require('discord-akairo');
const guessLeaderboard = require('../../models').guessLeaderboard;
const { MessageEmbed } = require('discord.js');
class guessCommand extends Command {
constructor() {
@ -36,7 +35,7 @@ class guessCommand extends Command {
if (args.leaderboard) {
const leaderboard = await guessLeaderboard.findAll({order: ['try']});
let top = [];
let leaderboardEmbed = new MessageEmbed()
let leaderboardEmbed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setTitle('Guess leaderboard');
for (let i = 0; i < leaderboard.length; i++) {

View file

@ -1,5 +1,4 @@
const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
class EvalCommand extends Command {
constructor() {
@ -37,7 +36,7 @@ class EvalCommand extends Command {
if (typeof evaled !== 'string')
evaled = require('util').inspect(evaled);
const evalEmbed = new MessageEmbed()
const evalEmbed = this.client.util.embed()
.setColor('#00FF00')
.setTitle('<a:orangejustice:522142267490697236> Eval succes <a:orangejustice:522142267490697236>')
.setThumbnail('https://cdn4.iconfinder.com/data/icons/gradient-ui-1/512/success-512.png')
@ -47,7 +46,7 @@ class EvalCommand extends Command {
message.channel.send(evalEmbed);
} catch (err) {
const errorEmbed = new MessageEmbed()
const errorEmbed = this.client.util.embed()
.setColor('#FF0000')
.setTitle('Eval failed <:sadpepe:534399181679230986>')
.setThumbnail('https://cdn4.iconfinder.com/data/icons/the-weather-is-nice-today/64/weather_48-512.png')

View file

@ -1,7 +1,6 @@
const { Command } = require('discord-akairo');
const util = require('util');
const exec = util.promisify(require('child_process').exec);
const { MessageEmbed } = require('discord.js');
class EvalCommand extends Command {
constructor() {
@ -20,7 +19,7 @@ class EvalCommand extends Command {
async exec(message) {
async function update() {
const { stdout, stderr } = await exec('git pull');
const Embed = new MessageEmbed()
const Embed = this.client.util.embed()
.addField('stdout', stdout)
.addField('stderr', stderr);
message.channel.send({embed: Embed});

View file

@ -1,5 +1,4 @@
const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
const { ownerID } = require('../../config.json');
const donator = require('../../models').donator;
@ -31,7 +30,7 @@ class aboutCommand extends Command {
}
const aboutEmbed = new MessageEmbed()
const aboutEmbed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setAuthor(this.client.user.username, this.client.user.avatarURL())
.setTitle('About me')

View file

@ -1,5 +1,4 @@
const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
class donateCommand extends Command {
constructor() {
@ -16,7 +15,7 @@ class donateCommand extends Command {
}
async exec(message) {
const Embed = new MessageEmbed()
const Embed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setTitle('Donation link')
.setDescription('If you decide to donate, please use the feedback command to let the owner know about it so he can put you in the about and donator command\n[Paypal](https://www.paypal.me/supositware)\n[Patreon](https://www.patreon.com/bePatron?u=15330358)\n[Brave referal program](https://brave.com/hah459)\nTip me with Brave BAT token on [my website](https://namejeff.xyz/)');

View file

@ -3,7 +3,6 @@ const fs = require('fs');
const youtubedl = require('youtube-dl');
const hbjs = require('handbrake-js');
const os = require('os');
const { MessageEmbed } = require('discord.js');
class DownloadCommand extends Command {
constructor() {
@ -51,7 +50,7 @@ class DownloadCommand extends Command {
}
const Embed = new MessageEmbed()
const Embed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setAuthor(`Downloaded by ${message.author.username}`, message.author.displayAvatarURL(), link)
.setDescription(args.caption)

View file

@ -1,6 +1,5 @@
const { Command } = require('discord-akairo');
const { feedbackChannel } = require('../../config.json');
const { MessageEmbed } = require('discord.js');
class FeedbackCommand extends Command {
constructor() {
@ -35,7 +34,7 @@ class FeedbackCommand extends Command {
const channel = this.client.channels.get(feedbackChannel);
const Embed = new MessageEmbed()
const Embed = this.client.util.embed()
.setAuthor(`${message.author.username} (${message.author.id})`, message.author.displayAvatarURL())
.addField('Guild', `${message.guild.name} (${message.guild.id})`, true)
.addField('Feedback', args.text)

View file

@ -1,6 +1,5 @@
const { Command } = require('discord-akairo');
const BannedWords = require('../../models').bannedWords;
const { MessageEmbed } = require('discord.js');
class seebannedwordCommand extends Command {
@ -31,7 +30,7 @@ class seebannedwordCommand extends Command {
if (list == undefined) return message.channel.send('No word are banned yet.');
const Embed = new MessageEmbed()
const Embed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setTitle('List of banned words')
.setDescription(list);

View file

@ -2,8 +2,6 @@ const { Command } = require('discord-akairo');
const Tag = require('../../models').Tag;
const fs = require('fs');
const os = require('os');
const { MessageEmbed } = require('discord.js');
class seetagCommand extends Command {
constructor() {
@ -38,7 +36,7 @@ class seetagCommand extends Command {
if (!tagList) return message.channel.send('Tag not found.');
this.client.users.fetch(tagList.dataValues.ownerID)
.then(user => {
const TagEmbed = new MessageEmbed()
const TagEmbed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setTitle(message.guild.name)
.addField('Trigger:', tagList['dataValues']['trigger'])
@ -54,7 +52,7 @@ class seetagCommand extends Command {
});
})
.catch(() => {
const TagEmbed = new MessageEmbed()
const TagEmbed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setTitle(message.guild.name)
.addField('Trigger:', tagList['dataValues']['trigger'])
@ -83,7 +81,7 @@ class seetagCommand extends Command {
} else {
let tagList = await Tag.findAll({attributes: ['trigger'], where: {serverID: message.guild.id}});
const tagString = tagList.map(t => t.trigger).join(', ') || 'No tags set.';
const TagEmbed = new MessageEmbed()
const TagEmbed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setTitle('List of tags')
.setDescription(tagString)

View file

@ -1,5 +1,4 @@
const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
class ServerCommand extends Command {
constructor() {
@ -17,7 +16,7 @@ class ServerCommand extends Command {
}
async exec(message) {
const addEmbed = new MessageEmbed()
const addEmbed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setTitle(message.guild.name)
.setThumbnail(message.guild.iconURL())

View file

@ -1,6 +1,6 @@
const { Command } = require('discord-akairo');
const akairoVersion = require('discord-akairo').version;
const { MessageEmbed, version } = require('discord.js');
const { version } = require('discord.js');
const util = require('util');
const exec = util.promisify(require('child_process').exec);
@ -51,7 +51,7 @@ class StatsCommand extends Command {
cpu = stdout.replace('Name', '');
}
const statsEmbed = new MessageEmbed()
const statsEmbed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setTitle('Bot stats')
.setAuthor('Haha yes')

View file

@ -1,5 +1,4 @@
const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
const fetch = require('node-fetch');
const { yandexAPI } = require('../../config.json');
@ -51,7 +50,7 @@ class TranslationCommand extends Command {
return message.channel.send('An error has occured');
const translationEmbed = new MessageEmbed()
const translationEmbed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setTitle('Asked for the following translation:')
.setAuthor(message.author.username)

View file

@ -1,5 +1,4 @@
const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
class UpdootCommand extends Command {
constructor() {
@ -17,7 +16,7 @@ class UpdootCommand extends Command {
}
async exec(message) {
const upDoot = new MessageEmbed()
const upDoot = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setTitle('Vote for my bot')
.setAuthor(message.author.username)

View file

@ -1,5 +1,4 @@
const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
class userInfoCommand extends Command {
constructor() {
@ -31,7 +30,7 @@ class userInfoCommand extends Command {
let member = message.guild.member(user);
const Embed = new MessageEmbed()
const Embed = this.client.util.embed()
.setColor(member.displayHexColor)
.setAuthor(`${user.tag} (${user.id})`, user.displayAvatarURL())
.addField('Current rank hex color', member.displayHexColor, true)

View file

@ -1,5 +1,4 @@
const { Listener } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
const { statsChannel } = require('../../config.json');
@ -14,7 +13,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 addEmbed = new MessageEmbed()
const addEmbed = this.client.util.embed()
.setColor('#52e80d')
.setTitle('New boiz in town')
.setURL('https://www.youtube.com/watch?v=6n3pFFPSlW4')

View file

@ -1,5 +1,4 @@
const { Listener } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
const { statsChannel } = require('../../config.json');
@ -15,7 +14,7 @@ class guildCreateListener extends Listener {
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 kickEmbed = new MessageEmbed()
const kickEmbed = this.client.util.embed()
.setColor('#FF0000')
.setTitle('Some mofo just removed me from there guild :(')
.setURL('https://www.youtube.com/watch?v=6n3pFFPSlW4')

View file

@ -1,5 +1,4 @@
const { Listener } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
const rand = require('../../rand.js');
const Sequelize = require('sequelize');
const Tag = require('../../models').Tag;
@ -33,7 +32,7 @@ class messageListener extends Listener {
let regex = new RegExp(bannedWords[i].get('word'), 'g');
censoredMessage = censoredMessage.replace(regex, '█'.repeat(bannedWords[i].get('word').length));
}
let Embed = new MessageEmbed()
let Embed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setAuthor(message.author.username, message.author.displayAvatarURL())
.setDescription(censoredMessage);
@ -183,7 +182,7 @@ class messageListener extends Listener {
}
}
const embed = new MessageEmbed()
const embed = this.client.util.embed()
.setColor(color)
.setTitle(title)
.setImage(image)

View file

@ -1,5 +1,4 @@
const { Listener } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
const fs = require('fs');
let messageID = require('../../json/starboard.json');
@ -59,7 +58,7 @@ class MessageReactionAddListener extends Listener {
channel = client.channels.get(shameboardChannel['shameboard']);
}
let Embed = new MessageEmbed()
let Embed = this.client.util.embed()
.setColor(reaction.message.member.displayHexColor)
.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)