Avoid sending welcome sticker if unavailable

This commit is contained in:
Ninjdai1 2023-09-04 10:55:38 +02:00
parent 47a1cfcce3
commit c24626b0f0

View File

@ -7,8 +7,8 @@ module.exports = {
if (guild.id==guildId){ if (guild.id==guildId){
const channel = await guild.channels.cache.find(c => c.id == generalChannelId ); const channel = await guild.channels.cache.find(c => c.id == generalChannelId );
try{ try{
const welcomesticker = await guild.stickers.fetch('985933707317743666') const welcomesticker = await guild.stickers.fetch('985933707317743666');
const message = await channel.send({ content: welcomemessage.replace("[memberid]", member.id), stickers:[welcomesticker]}); const message = await channel.send({ content: welcomemessage.replace("[memberid]", member.id), stickers: welcomesticker.available ? [welcomesticker] : []});
Promise.all([ Promise.all([
message.react('👋'), message.react('👋'),
]).catch(error => console.error(error)) ]).catch(error => console.error(error))