Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //javascript
- if (message.content.startsWith('/sell')) {
- var arr = message.content.slice('/sell'.length + 1).split(" ");
- var price = arr[0];
- arr.shift();
- var game = arr[0];
- arr.shift();
- var item = arr.toString().replace(/,/g, " ");
- message.channel.send(`Please confirm the following transaction:\n\`\`\`\nSelling Item: ${item}\nPrice: ${price}\nGame: ${game}\n\`\`\``)
- .then(async msg => {
- await msg.react('✅');
- await msg.react('❎');
- msg.awaitReactions({
- max: 1,
- time: 30000,
- errors: ['time']
- })
- .then(collected => {
- const reaction = collected.first();
- switch (reaction.emoji.name) {
- case '❎':
- console.log('Reacted as CROSS');
- message.reply('Your transaction is deleted.');
- break;
- case '✅':
- console.log('Reacted as TICK');
- message.reply(`Your transaction is applied successfully!`);
- }
- })
- .catch(collected => {
- return message.channel.send('ERROR');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement