nodbot/commands/savepasta.js

19 lines
783 B
JavaScript
Raw Normal View History

2021-07-01 22:12:21 +00:00
const functions = require('../functions.js');
module.exports = {
name: 'savepasta',
description: 'Adds a given copypasta to the hardcoded list.',
2021-07-06 21:37:29 +00:00
usage: '<Copy Pasta Text> <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 => {
message.channel.send(functions.savePasta(message, file.name, functions.cleanInput(pastaMessage.content)));
})
})
.catch(err => console.error(err));
2021-07-01 22:12:21 +00:00
}
}