diff --git a/src/events/guildCreate.ts b/src/events/guildCreate.ts index e428c06..088d8a1 100644 --- a/src/events/guildCreate.ts +++ b/src/events/guildCreate.ts @@ -1,4 +1,11 @@ -import { Client, EmbedBuilder, Guild, TextChannel } from "discord.js"; +import { + ChannelType, + Client, + EmbedBuilder, + Guild, + PermissionFlagsBits, + TextChannel, +} from "discord.js"; import { ALStorage, loggingSystem } from ".."; export const name = "guildCreate"; export const execute = async (guild: Guild, client: Client) => { @@ -12,6 +19,21 @@ export const execute = async (guild: Guild, client: Client) => { .setTimestamp() .setThumbnail(guild.iconURL()) .setFooter({ text: String(guild.id) }); + const firstChannel = guild.channels.cache.find( + (c) => + c.type === ChannelType.GuildText && + c.permissionsFor(guild.members.me!).has(PermissionFlagsBits.SendMessages) + ); + if (firstChannel && firstChannel instanceof TextChannel) { + const thanksEmbed = new EmbedBuilder() + .setTitle("UniBotをご利用いただきありがとうございます :tada:") + .setDescription( + "サーバーに招待していただきありがとうございます!\nUniBotは皆様のサーバー運営を支援するために設計された多機能なDiscordボットです。\nサポートサーバーへもぜひお越しください: https://uniproject.jp/discord" + ) + .setColor(client.config.color.success) + .setTimestamp(); + await firstChannel.send({ embeds: [thanksEmbed] }); + } if (!channel || !(channel instanceof TextChannel)) { logger.error( { extra_context: { channelId: client.config.logch.guildCreate } },