Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.99 KB | None | 0 0
  1. const Discord = require('discord.js');
  2. const bot = new Discord.Client();
  3. const config = require('./config.json');
  4. bot.on('message', async message => {
  5. let prefix = config.prefix;
  6. client.on('ready', () => {
  7. console.log('I am ready!');
  8. });
  9.  
  10. client.on('message', message => {
  11. // Ignore messages that aren't from a guild
  12. if (!message.guild) return;
  13.  
  14. // If the message content starts with "!kick"
  15. if (message.content.startsWith('ali!kick')) {
  16. // Assuming we mention someone in the message, this will return the user
  17. // Read more about mentions over at https://discord.js.org/#/docs/main/master/class/MessageMentions
  18. const user = message.mentions.users.first();
  19. // If we have a user mentioned
  20. if (user) {
  21. // Now we get the member from the user
  22. const member = message.guild.member(user);
  23. // If the member is in the guild
  24. if (member) {
  25. /**
  26. * Kick the member
  27. * Make sure you run this on a member, not a user!
  28. * There are big differences between a user and a member
  29. */
  30. member.kick('Optional reason that will display in the audit logs').then(() => {
  31. // We let the message author know we were able to kick the person
  32. message.reply(`Был успешно кикнут ${user.tag}`);
  33. }).catch(err => {
  34. // An error happened
  35. // This is generally due to the bot not being able to kick the member,
  36. // either due to missing permissions or role hierarchy
  37. message.reply('Я не могу его заблокировать');
  38. // Log the error
  39. console.error(err);
  40. });
  41. } else {
  42. // The mentioned user isn't in this guild
  43. message.reply('Этого пользователя нету в этом Discord сервере');
  44. }
  45. // Otherwise, if no user was mentioned
  46. } else {
  47. message.reply('Вы не упоминули пользователя, которого хотите заблокировать');
  48. }
  49. }
  50. });
  51. ``// Ignore messages that aren't from a guild
  52. if (!message.guild) return;
  53.  
  54. // if the message content starts with "!ban"
  55. if (message.content.startsWith('ali!ban')) {
  56. // Assuming we mention someone in the message, this will return the user
  57. // Read more about mentions over at https://discord.js.org/#/docs/main/stable/class/MessageMentions
  58. const user = message.mentions.users.first();
  59. // If we have a user mentioned
  60. if (user) {
  61. // Now we get the member from the user
  62. const member = message.guild.member(user);
  63. // If the member is in the guild
  64. if (member) {
  65. /**
  66. * Ban the member
  67. * Make sure you run this on a member, not a user!
  68. * There are big differences between a user and a member
  69. * Read more about what ban options there are over at
  70. * https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=ban
  71. */
  72. member.ban({
  73. reason: 'Причина в канале банов.',
  74. }).then(() => {
  75. // We let the message author know we were able to ban the person
  76. message.reply(`Успешно заблокировал ${user.tag}`);
  77. }).catch(err => {
  78. // An error happened
  79. // This is generally due to the bot not being able to ban the member,
  80. // either due to missing permissions or role hierarchy
  81. message.reply('Я не могу его заблокировать');
  82. // Log the error
  83. console.error(err);
  84. });
  85. } else {
  86. // The mentioned user isn't in this guild
  87. message.reply('Этого пользователя нету в этом Discord сервере');
  88. }
  89. } else {
  90. // Otherwise, if no user was mentioned
  91. message.reply('Вы не упоминули пользователя, которого хотите заблокировать');
  92. }
  93.  
  94.  
  95. }
  96. if (message.content.startsWith(prefix + 'help')) {
  97. let embed = new Discord.RichEmbed()
  98.  
  99. .addField(`1. dev`, `Показывает разработчика бота`)
  100.  
  101. .addField(`2. donate`, `Данные чтоб дать денюшку создателю(ᵔᴥᵔ)`)
  102.  
  103. .addField(`3. my avatar`, `Показывает ваш аватар в Discord`)
  104. .addField(`4. ban`, `Блокирует участника на вашем сервере(доступно административным правам)`)
  105. .addField(`5. kick`, `Кикает участника на вашем сервере(доступно административным правам)`)
  106. .addField(`5. info-bot`, `Показывает информацию о боте`)
  107. .setColor(`#ff04b6`)
  108. await message.channel.send(embed)
  109. }
  110. if (message.content.startsWith(prefix + 'dev')) {
  111. let embed = new Discord.RichEmbed()
  112.  
  113. .addField(`Discord:`, `ALham#0666`)
  114. .addField(`Почта:`, `pastuhov.slava666@mail.ru`)
  115. .addField(`По багам писать на почту,если просто вы хотите благодорить за бота, то пишите в Discord`, `-----------------`)
  116.  
  117. .setColor(`#ff04b6`)
  118. await message.channel.send(embed)
  119. }
  120. if (message.content.startsWith(prefix + 'donate')) {
  121. let embed = new Discord.RichEmbed()
  122.  
  123. .addField(`Привет(◕‿◕)♡,держи донат ссылку чтоб помочь денюшкой`, `https://www.donationalerts.com/r/alham2287`)
  124.  
  125. .setColor(`#ff04b6`)
  126. await message.channel.send(embed)
  127. }
  128. if (message.content === 'ali!my avatar') {
  129. message.reply(message.author.avatarURL);
  130. }
  131. if (message.content.startsWith(prefix + 'info-bot')) {
  132. let embed = new Discord.RichEmbed()
  133. .addField(`Информация о боте`, `-------------------------`)
  134. .addField(`Имя: Alibaba`, `День рождения: 08.11.2019`)
  135. .addField(`Ссылка приглашения:https://discordapp.com/oauth2/authorize?client_id=642299768889933825&permissions=8&scope=bot`, `Создатель: ALham`)
  136. .addField(`Версия:БЕТА 0.0.3`, `Все права защищены`)
  137. setThumbnail(`bot.avatarURL`)
  138. }
  139. })
  140.  
  141.  
  142. bot.login(config.token);
  143. bot.on('ready', () => {
  144. console.log('I am ready!');
  145. });
  146. client.on('message', message => {
  147. bot.generateInvite(["ADMINISTRATOR"]).then(link =>{
  148. console.log(link);
  149. console.log(${bot.user.username} online);
  150. bot.user.setPresence ({status: 'dnd', game:{name: '|!Привет|Префикс | ! | БЕТА 0.0.1 | ', type: 0}});
  151. });
  152.  
  153. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement