Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
Problemas para hacer un comando para obligar al bot a abandonar un servidor. (Discordia, js)
const Discord = require('discord.js') const client = new Discord.Client({ws: {intents: Discord.Intents.ALL}}); const botowner = 'xxx' exports.run = async (bot,message,args) => { let guildid = message.guild.id if (message.author.id = botowner) { toleave = client.get_server(guildid) await client.leave_server(toleave) } else {message.channel.send("You are not the bot owner")} } exports.help = { name: ['leavediscordserver'] }

Cada vez que ejecuto este código, aparece lo siguiente: ingrese la descripción de la imagen aquí

No estoy seguro de por qué ocurre esto.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

El mensaje de error le dice todo lo que necesita saber. Intenta usar una función llamada get_server() , pero esta función no existe, por lo que no puede usarla.

Un servidor de discordia en Discord.js se denomina Gremio, por lo que para obtener su gremio puede simplemente llamar a const guild = client.guilds.cache.fetch(guildid) y para dejarlo todo lo que tiene que hacer es llamar a guild.leave() .

Como tema aparte, una comparación en una declaración if se realiza con 2 signos iguales == no 1 como lo hizo en su línea if (message.author.id = botowner) .

about 4 years ago · Juan Pablo Isaza Report

0

var guildID = client.guilds.cache.get(args[0]) //your argument would be the server id if (message.author.id == botowner) { // use == to check if author and bot owner id match await guildID.leave() // waiting for bot to leave the server } else {message.channel.send("You are not the bot owner")} }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!