Add /edit strain
#9
@ -8,7 +8,9 @@ module.exports = {
|
||||
const client = message.client;
|
||||
let pastaData;
|
||||
if (!client.pastas.has(commandData.args)) {
|
||||
commandData.content = 'Sorry I couldn\'t find that pasta.';
|
||||
pastaData = {
|
||||
content: "Sorry, I couldn't find that pasta."
|
||||
};
|
||||
} else {
|
||||
pastaData = client.pastas.get(commandData.args);
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ const functions = {
|
||||
return { embeds: [ new Discord.MessageEmbed()
|
||||
.setAuthor({name: `${commandData.args}.${commandData.command}`})
|
||||
.setDescription(pastaData.content)
|
||||
.setThumbnail(pastaData.iconUrl)
|
||||
.setThumbnail("https://assets.vfsh.dev/shednod.png")
|
||||
.setTimestamp()
|
||||
.setFooter({text: commandData.author})]};
|
||||
},
|
||||
@ -395,12 +395,13 @@ const functions = {
|
||||
functions.download.requests(client);
|
||||
});
|
||||
},
|
||||
pasta(pastaData, client) {
|
||||
async pasta(pastaData, client) {
|
||||
const query = `INSERT INTO pastas (name, content) VALUES (${db.escape(pastaData.name)},${db.escape(pastaData.content)}) ON DUPLICATE KEY UPDATE content=${db.escape(pastaData.content)}`;
|
||||
db.query(query, (err, rows, fields) => {
|
||||
await db.query(query, (err, rows, fields) => {
|
||||
if (err) throw err;
|
||||
functions.download.pastas(client);
|
||||
});
|
||||
return;
|
||||
},
|
||||
joint(content, client) {
|
||||
const query = `INSERT INTO joints (content) VALUES (${db.escape(content)})`;
|
||||
|
@ -207,7 +207,7 @@ module.exports = {
|
||||
name: interaction.options.getString('pasta-name').toLowerCase(),
|
||||
content: interaction.options.getString('pasta-content'),
|
||||
};
|
||||
fn.upload.pasta(pastaData, interaction.client);
|
||||
await fn.upload.pasta(pastaData, interaction.client);
|
||||
interaction.editReply({content: `The copypasta has been saved as ${pastaData.name}.pasta`, ephemeral: true });
|
||||
break;
|
||||
// Strain
|
||||
|
Loading…
Reference in New Issue
Block a user