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

161
Views
Unbanning members on event from Discord server

I made the event guildBanAdd to unban specific ids, but I want it to unban only those ids that got banned, because for the ids that didn't get banned I get the error of an unknown ban.

const cool = ['607868627181502467', '638038115277340723', '347651751651966978'];
const { Client, guild, Message } = require('discord.js');


module.exports = {
  name: 'guildBanAdd',
  execute(message, guild, member, client) {
    cool.forEach((fB) => {
      message.guild.members.unban(fB);
    })
  }
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Perhaps simply checking the guild's bans will help

const cool = ['607868627181502467', '638038115277340723', '347651751651966978']

module.exports = {
  name: 'guildBanAdd',
  async execute(message, guild, member, client) {
    const guildBans = await message.guild.bans.fetch()
    //await message.guild.fetchBans() on v12
    cool.forEach((fB)=>{
      if(guildBans.has(fB)) message.guild.members.unban(fB)
    })
  }
}

Docs

Guild.bans: docs for v13

Guild.fetchBans(): docs for v12

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!