Add /edit strain #9

Closed
voidf1sh wants to merge 10 commits from dev into main
3 changed files with 8 additions and 5 deletions
Showing only changes of commit 82f65a800c - Show all commits

View File

@ -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);
}

View File

@ -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)})`;

View File

@ -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