add icons to pastas
This commit is contained in:
parent
1d9d3e0750
commit
6ed02de8dc
@ -8,11 +8,13 @@ module.exports = {
|
||||
const client = message.client;
|
||||
const replyHeader = `\'${file.name}\' requested by: ${message.author.username}\n`;
|
||||
let replyBody = '';
|
||||
let iconUrl;
|
||||
if (!client.pastas.has(file.name)) {
|
||||
replyBody = 'Sorry I couldn\'t find that pasta.';
|
||||
} else {
|
||||
replyBody = client.pastas.get(file.name).content;
|
||||
iconUrl = client.pastas.get(file.name).iconUrl;
|
||||
}
|
||||
message.channel.send(functions.textEmbed(replyBody, message.author, `${file.name}.${file.extension}`));
|
||||
message.channel.send(functions.pastaEmbed(replyBody, iconUrl, message.author));
|
||||
}
|
||||
}
|
13
functions.js
13
functions.js
@ -65,14 +65,15 @@ module.exports = {
|
||||
getPastaFiles(client) {
|
||||
if (!client.pastas) client.pastas = new Discord.Collection();
|
||||
client.pastas.clear();
|
||||
const query = "SELECT name, content FROM pastas";
|
||||
const query = "SELECT name, content, iconurl FROM pastas";
|
||||
return new Promise((resolve, reject) => {
|
||||
db.query(query)
|
||||
.then(res => {
|
||||
for (let row of res.rows) {
|
||||
const pasta = {
|
||||
name: row.name,
|
||||
content: row.content
|
||||
content: row.content,
|
||||
iconUrl: row.iconurl
|
||||
};
|
||||
client.pastas.set(pasta.name, pasta);
|
||||
}
|
||||
@ -172,6 +173,14 @@ module.exports = {
|
||||
.setTimestamp()
|
||||
.setFooter(`@${author.username}#${author.discriminator}`);
|
||||
},
|
||||
pastaEmbed(content, iconUrl, author) {
|
||||
return new Discord.MessageEmbed()
|
||||
.setAuthor('Command: ' + 'pasta')
|
||||
.setDescription(content)
|
||||
.setThumbnail(iconUrl)
|
||||
.setTimestamp()
|
||||
.setFooter(`@${author.username}#${author.discriminator}`);
|
||||
},
|
||||
createStockEmbed(data, author, command) {
|
||||
return new Discord.MessageEmbed()
|
||||
.setAuthor('Command: ' + command)
|
||||
|
Loading…
Reference in New Issue
Block a user