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