0

I used a code to make the welcome message work on my server, I could choose any text channel so that the message would be sent as soon as a new member joined the server, but for a few days this code stopped working without any problem at the bot terminal.

I've done several tests even with other welcome codes but none of them work.

this is the code where the welcome message goes, it searches the database for the channel that was defined through a command

bot.on("guildMemberAdd", (member) => {
  let chx = db.fetch(`welchannel_${member.guild.id}`);
  
  if(chx === null) {
    return;
  }

  let wembed = new MessageEmbed()
  .setAuthor(member.user.username, member.user.avatarURL())
  .setColor("#ff2050")
  .setThumbnail(member.user.avatarURL())
  .setDescription(`We are very happy to have you in our server`);
  
  bot.channels.cache.get(chx).send(wembed)
})

this is the command that defines the channel where the welcome message will be sent.

in the database the information is entered correctly.

const db = require("../../database");
const Discord = require("discord.js");
const { DiscordAPIError, MessageEmbed } = require("discord.js");
module.exports = {
  name: "set",
  description: "Set the prefix of the guild!",
  category: "config",
  aliases: "bemvindos",
  run: async (bot, message, args) => {

    let channel = message.mentions.channels.first()
    
    if(!channel) {
      return message.channel.send("Please Mention the channel first")
    }
    
    //Now we gonna use quick.db
    
    db.set(`welchannel_${message.guild.id}`, channel.id)
    
    message.channel.send(`Welcome Channel is seted as ${channel}`)
  }
}

the new member enters the server and the bot does not send the message on the defined channel or at least one error message on the terminal.

Syntax
  • 1
  • 3
  • There was a recent API change requiring discord developers to enable Member Intents in their Discord Developer page. Without that you don't receive any member related events. – Tin Nguyen Nov 03 '20 at 10:36
  • @Tin Nguyen and how I do it? – Syntax Nov 03 '20 at 10:49
  • https://discordpy.readthedocs.io/en/latest/intents.html?highlight=member%20intents#privileged-intents It's described here how you can enable Member Intents on your Discord Developers page. – Tin Nguyen Nov 03 '20 at 10:52
  • @Tin Nguyen I activated the functions but it still doesn't work – Syntax Nov 03 '20 at 10:59

0 Answers0