UNPKG

welcomerpackage

Version:

A package to send customized welcome messages to new members joining your Discord server using discord.js.

13 lines (12 loc) 697 B
// src/index.ts import { EmbedBuilder } from "discord.js"; function sendWelcomeMessage(member, options = {}) { const channel = options.channelId ? member.guild.channels.cache.get(options.channelId) : member.guild.systemChannel; if (!channel) return; const color = options.color || "#0099ff"; const welcomeEmbed = new EmbedBuilder().setColor(color).setTitle(options.title || "Welcome!").setDescription(options.description || `Welcome to the server, ${member.user.username}!`).setThumbnail(options.thumbnailUrl || member.user.displayAvatarURL({ dynamic: true })).setImage(options.imageUrl || "").setTimestamp(); channel.send({ embeds: [welcomeEmbed] }); } export { sendWelcomeMessage };