0

i work on discord bot , and when a people add the bot to their server , with :

bot.on("guildCreate", guild => {
    let logoUrl = "https://cdn.discordapp.com/icons/"+ guild.id + "/" + guild.icon

    console.log(guild.name)
    connection.query("INSERT INTO `servers` (`discord_server_id`, `server_name`, `server_logo`) VALUES ('" + guild.id + "', '" + guild.name + "', '" + logoUrl + "')");

})

But when server have an emoji in the guild.name , the bot crash with this error :

enter image description here

1 Answers1

0

This is a mysql related problem, so you may need to alter your table using utf8mb4 format:

ALTER DATABASE <database> CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
Paul-Marie
  • 874
  • 1
  • 6
  • 24