Advertisement
ENIRBOREH_XD

Untitled

Jul 17th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. //javascript
  2. if (message.content.startsWith('/sell')) {
  3. var arr = message.content.slice('/sell'.length + 1).split(" ");
  4. var price = arr[0];
  5. arr.shift();
  6. var game = arr[0];
  7. arr.shift();
  8. var item = arr.toString().replace(/,/g, " ");
  9.  
  10. message.channel.send(`Please confirm the following transaction:\n\`\`\`\nSelling Item: ${item}\nPrice: ${price}\nGame: ${game}\n\`\`\``)
  11. .then(async msg => {
  12. await msg.react('✅');
  13. await msg.react('❎');
  14. msg.awaitReactions({
  15. max: 1,
  16. time: 30000,
  17. errors: ['time']
  18. })
  19. .then(collected => {
  20. const reaction = collected.first();
  21. switch (reaction.emoji.name) {
  22. case '❎':
  23. console.log('Reacted as CROSS');
  24. message.reply('Your transaction is deleted.');
  25. break;
  26. case '✅':
  27. console.log('Reacted as TICK');
  28.  
  29. message.reply(`Your transaction is applied successfully!`);
  30. }
  31. })
  32. .catch(collected => {
  33. return message.channel.send('ERROR');
  34. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement