From 5575ebba4fea31fb32042b2992cf8b67ad6a74d6 Mon Sep 17 00:00:00 2001 From: "Yuito Akatsuki (Tani Yutaka)" Date: Sun, 2 Nov 2025 09:40:52 +0900 Subject: [PATCH] =?UTF-8?q?thankyou=20message=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/events/guildCreate.ts | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) 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 } },