April/events/guildMemberAdd.mjs

33 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-10-13 15:04:11 +02:00
import config from "../config.json" assert { type: "json" };
2023-09-13 21:12:45 +02:00
const { guildId, generalChannelId, rulesChannelId } = config;
2023-09-13 21:12:45 +02:00
export default {
2023-10-13 15:04:11 +02:00
name: "guildMemberAdd",
async execute(member, client) {
const guild = member.guild;
if (guild.id == guildId) {
const channel = await guild.channels.cache.find(
(c) => c.id == generalChannelId,
);
try {
const welcomesticker =
await guild.stickers.fetch("985933707317743666");
const message = await channel.send({
content: welcomemessage.replace("[memberid]", member.id),
stickers: welcomesticker.available ? [welcomesticker] : [],
});
Promise.all([message.react("👋")]).catch((error) =>
console.error(error),
);
} catch (error) {
console.log(error);
}
}
},
};
2023-10-13 15:04:11 +02:00
const welcomemessage = `☆ Bienvenue <@[memberid]> ☆
Je t'invite à aller lire le <#${rulesChannelId}> ainsi que de prendre tes rôles dans <id:customize>
Nous espérons que tu passera un bon moment sur Art' Portal ! ^^`;