Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js');
- const bot = new Discord.Client();
- const config = require('./config.json');
- bot.on('message', async message => {
- let prefix = config.prefix;
- client.on('ready', () => {
- console.log('I am ready!');
- });
- client.on('message', message => {
- // Ignore messages that aren't from a guild
- if (!message.guild) return;
- // If the message content starts with "!kick"
- if (message.content.startsWith('ali!kick')) {
- // Assuming we mention someone in the message, this will return the user
- // Read more about mentions over at https://discord.js.org/#/docs/main/master/class/MessageMentions
- const user = message.mentions.users.first();
- // If we have a user mentioned
- if (user) {
- // Now we get the member from the user
- const member = message.guild.member(user);
- // If the member is in the guild
- if (member) {
- /**
- * Kick the member
- * Make sure you run this on a member, not a user!
- * There are big differences between a user and a member
- */
- member.kick('Optional reason that will display in the audit logs').then(() => {
- // We let the message author know we were able to kick the person
- message.reply(`Был успешно кикнут ${user.tag}`);
- }).catch(err => {
- // An error happened
- // This is generally due to the bot not being able to kick the member,
- // either due to missing permissions or role hierarchy
- message.reply('Я не могу его заблокировать');
- // Log the error
- console.error(err);
- });
- } else {
- // The mentioned user isn't in this guild
- message.reply('Этого пользователя нету в этом Discord сервере');
- }
- // Otherwise, if no user was mentioned
- } else {
- message.reply('Вы не упоминули пользователя, которого хотите заблокировать');
- }
- }
- });
- ``// Ignore messages that aren't from a guild
- if (!message.guild) return;
- // if the message content starts with "!ban"
- if (message.content.startsWith('ali!ban')) {
- // Assuming we mention someone in the message, this will return the user
- // Read more about mentions over at https://discord.js.org/#/docs/main/stable/class/MessageMentions
- const user = message.mentions.users.first();
- // If we have a user mentioned
- if (user) {
- // Now we get the member from the user
- const member = message.guild.member(user);
- // If the member is in the guild
- if (member) {
- /**
- * Ban the member
- * Make sure you run this on a member, not a user!
- * There are big differences between a user and a member
- * Read more about what ban options there are over at
- * https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=ban
- */
- member.ban({
- reason: 'Причина в канале банов.',
- }).then(() => {
- // We let the message author know we were able to ban the person
- message.reply(`Успешно заблокировал ${user.tag}`);
- }).catch(err => {
- // An error happened
- // This is generally due to the bot not being able to ban the member,
- // either due to missing permissions or role hierarchy
- message.reply('Я не могу его заблокировать');
- // Log the error
- console.error(err);
- });
- } else {
- // The mentioned user isn't in this guild
- message.reply('Этого пользователя нету в этом Discord сервере');
- }
- } else {
- // Otherwise, if no user was mentioned
- message.reply('Вы не упоминули пользователя, которого хотите заблокировать');
- }
- }
- if (message.content.startsWith(prefix + 'help')) {
- let embed = new Discord.RichEmbed()
- .addField(`1. dev`, `Показывает разработчика бота`)
- .addField(`2. donate`, `Данные чтоб дать денюшку создателю(ᵔᴥᵔ)`)
- .addField(`3. my avatar`, `Показывает ваш аватар в Discord`)
- .addField(`4. ban`, `Блокирует участника на вашем сервере(доступно административным правам)`)
- .addField(`5. kick`, `Кикает участника на вашем сервере(доступно административным правам)`)
- .addField(`5. info-bot`, `Показывает информацию о боте`)
- .setColor(`#ff04b6`)
- await message.channel.send(embed)
- }
- if (message.content.startsWith(prefix + 'dev')) {
- let embed = new Discord.RichEmbed()
- .addField(`Discord:`, `ALham#0666`)
- .addField(`Почта:`, `pastuhov.slava666@mail.ru`)
- .addField(`По багам писать на почту,если просто вы хотите благодорить за бота, то пишите в Discord`, `-----------------`)
- .setColor(`#ff04b6`)
- await message.channel.send(embed)
- }
- if (message.content.startsWith(prefix + 'donate')) {
- let embed = new Discord.RichEmbed()
- .addField(`Привет(◕‿◕)♡,держи донат ссылку чтоб помочь денюшкой`, `https://www.donationalerts.com/r/alham2287`)
- .setColor(`#ff04b6`)
- await message.channel.send(embed)
- }
- if (message.content === 'ali!my avatar') {
- message.reply(message.author.avatarURL);
- }
- if (message.content.startsWith(prefix + 'info-bot')) {
- let embed = new Discord.RichEmbed()
- .addField(`Информация о боте`, `-------------------------`)
- .addField(`Имя: Alibaba`, `День рождения: 08.11.2019`)
- .addField(`Ссылка приглашения:https://discordapp.com/oauth2/authorize?client_id=642299768889933825&permissions=8&scope=bot`, `Создатель: ALham`)
- .addField(`Версия:БЕТА 0.0.3`, `Все права защищены`)
- setThumbnail(`bot.avatarURL`)
- }
- })
- client.on('message', message => {
- bot.generateInvite(["ADMINISTRATOR"]).then(link =>{
- console.log(link);
- console.log($`{bot.user.username} online`);
- bot.user.setPresence ({status: 'dnd', game:{name: '|!Привет|Префикс | ! | БЕТА 0.0.1 | ', type: 0}});
- });
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement