nodbot/commands/savepasta.js

19 lines
873 B
JavaScript
Raw Normal View History

2021-07-01 22:12:21 +00:00
const functions = require('../functions.js');
module.exports = {
name: 'savepasta',
2021-07-19 02:23:40 +00:00
description: 'Saves a copypasta as pasta_name.pasta, just send the pasta name on the first message, and the bot will ask for the actual pasta afterwards.',
usage: '<Pasta Name>',
2021-07-01 22:12:21 +00:00
execute(message, file) {
2021-07-16 14:01:44 +00:00
message.channel.send(`I'll be saving the next message you send as ${file.name}.pasta\nWhat is the content of the copypasta?`)
.then(promptMessage => {
const pastaFilter = pastaMessage => pastaMessage.author == message.author;
const pastaCollector = promptMessage.channel.createMessageCollector(pastaFilter, { time: 30000, max: 1 });
2021-07-01 22:12:21 +00:00
2021-07-16 14:01:44 +00:00
pastaCollector.on('collect', pastaMessage => {
2021-07-24 20:08:34 +00:00
message.channel.send(functions.savePasta(message, file.name.toLowerCase(), functions.cleanInput(pastaMessage.content)));
2021-07-16 14:01:44 +00:00
})
})
.catch(err => console.error(err));
2021-07-01 22:12:21 +00:00
}
}