Este equipo redactor ha estado largas horas investigando para dar soluciones a tus búsquedas, te ofrecemos la solución por eso nuestro deseo es serte de mucha ayuda.
Ejemplo 1: comando de prohibición de Discord.js
if(msg.member.hasPermission("BAN_MEMBERS"))if(msg.members.mentions.first())try
msg.members.mentions.first().ban();catch
msg.reply("I do not have permissions to ban"+ msg.members.mentions.first());else
msg.reply("You do not have permissions to ban"+ msg.members.mentions.first());
Ejemplo 2: comando de prohibición de Discord.js
// Import the discord.js moduleconstDiscord=require('discord.js');// Create an instance of a Discord clientconst client =newDiscord.Client();/**
* The ready event is vital, it means that only _after_ this will your bot start reacting to information
* received from Discord
*/
client.on('ready',()=>console.log('I am ready!'););
client.on('message',message=>// Ignore messages that aren't from a guildif(!message.guild)return;// if the message content starts with "!ban"if(message.content.startsWith('!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/master/class/MessageMentionsconst user = message.mentions.users.first();// If we have a user mentionedif(user)// Now we get the member from the userconst member = message.guild.members.resolve(user);// If the member is in the guildif(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/master/class/GuildMember?scrollTo=ban
*/
member
.ban(
reason:'They were bad!',).then(()=>// We let the message author know we were able to ban the person
message.channel.send(`Successfully banned $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.channel.send('I was unable to ban the member');// Log the errorconsole.error(err););else// The mentioned user isn't in this guild
message.channel.send("That user isn't in this guild!");else// Otherwise, if no user was mentioned
message.channel.send("You didn't mention the user to ban!"););// Log our bot in using the token from https://discord.com/developers/applications
client.login('your token here');
Nos encantaría que puedieras comunicar esta noticia si te valió la pena.
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)