Advertisement
Guest User

Discordbot

a guest
Jan 17th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. var Discord = require('discord.io');
  2. var logger = require('winston');
  3. var auth = require('./auth.json');
  4. // Configure logger settings
  5. logger.remove(logger.transports.Console);
  6. logger.add(logger.transports.Console, {
  7. colorize: true
  8. });
  9. logger.level = 'debug';
  10. // Initialize Discord Bot
  11. var bot = new Discord.Client({
  12. token: auth.token,
  13. autorun: true
  14. });
  15. bot.on('ready', function (evt) {
  16. logger.info('Connected');
  17. logger.info('Logged in as: ');
  18. logger.info(bot.username + ' - (' + bot.id + ')');
  19. });
  20. bot.on('message', function (user, userID, channelID, message, evt) {
  21. // Our bot needs to know if it will execute a command
  22. // It will listen for messages that will start with `!`
  23. if (message.substring(0, 1) == '@PVE') {
  24. var args = message.substring(1).split(' ');
  25. var cmd = args[0];
  26.  
  27. args = args.splice(1);
  28. switch(cmd) {
  29. // @PVE
  30. case 'PVE':
  31. bot.sendMessage({
  32. to: channelID,
  33. message: 'Fuck you @IrishRebelA07#7394'
  34. });
  35. break;
  36. // Just add any case commands if you want to..
  37. }
  38. }
  39. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement