Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. const Discord = require('discord.js');
  2. const bot = new Discord.Client();
  3.  
  4. bot.on("ready", () => {
  5. console.log("ready");
  6. });
  7.  
  8. /*roles:
  9. * admin: 259140225622605824
  10. * mod: 275635333004263424
  11. */
  12.  
  13. bot.on("message", message => {
  14. if (message.content.startsWith(".prune")) {
  15. // console.log(message.guild.roles);
  16. if (message.author.id == 219567184089841664) { message.channel.send("hek u nik"); return; }
  17. if (message.member.roles.has("259140225622605824") || message.member.roles.has("275635333004263424")) {
  18. if (message.content.length > 7 && message.content.startsWith(".prune ")) {
  19. if (isNaN(parseInt(message.content.substring(7)))) {
  20. message.channel.send("`ERR: no # val found` | Usage: `.prune n` where n = messages to delete");
  21. } else {
  22. var delmsgs = parseInt(message.content.substring(7));
  23. if (delmsgs > 99 || delmsgs < 2) {
  24. message.channel.send("Cannot delete more than 99 msgs or less than 2 msgs.");
  25. } else {
  26. message.channel.fetchMessages({limit: (delmsgs+1)})
  27. .then(messages => {
  28. message.channel.send("Pruned "+delmsgs+" messages!");
  29. message.channel.bulkDelete(messages);
  30. })
  31. .catch(console.error);
  32. }
  33. }
  34. } else {
  35. message.channel.send("`ERR: improper arg format` | Usage: `.prune n` where n = messages to delete");
  36. }
  37. } else {
  38. message.channel.send("`ERR: Insufficient permissions to use this command` | Usage: `.prune n` where n = messages to delete");
  39. }
  40. }
  41. });
  42.  
  43. bot.on("guildMemberAdd", member => {
  44. member.guild.channels.get("277511282574360577").send(`Welcome to the trans channel, <@${member.id}>! Make sure to mention a <@&275635333004263424> or <@&259140225622605824> that is online or wait for someone to help you. Once verified you will be able to gain access to the rest of the channels.
  45.  
  46. To be verified please tell a staff member your gender and a preferred name if you want. Have fun and enjoy your stay here!
  47.  
  48. **It may take a few hours for a moderator or admin to get back to you, as we often are sleeping, or eating, or something.**`);
  49. });
  50.  
  51. bot.login(token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement