Skip to content

Conversation

@yuito-it
Copy link
Member

@yuito-it yuito-it commented Nov 2, 2025

No description provided.

@yuito-it yuito-it requested review from ayane0857 and Copilot November 2, 2025 00:41
@yuito-it yuito-it added Type: Enhancement About Enhancement.機能強化に関するもの。 Priority: High 優先度高め。 labels Nov 2, 2025
@yuito-it yuito-it self-assigned this Nov 2, 2025
@yuito-it yuito-it added Type: Publishing About publishing.公開に関するもの Status: Review Needed レビュー待ち。Waiting for review. labels Nov 2, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a welcome message feature to the guildCreate event handler that sends a thank-you message in Japanese to the first available text channel when the bot joins a new Discord server.

Key Changes

  • Added new imports (ChannelType, PermissionFlagsBits) for channel filtering and permission checks
  • Implemented logic to find the first text channel where the bot has send message permissions
  • Added a welcome embed message that is automatically sent to the identified channel

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const firstChannel = guild.channels.cache.find(
(c) =>
c.type === ChannelType.GuildText &&
c.permissionsFor(guild.members.me!).has(PermissionFlagsBits.SendMessages)
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guild.members.me may be null if the bot's member object hasn't been cached yet during the guildCreate event. The non-null assertion operator (!) could cause a runtime error. Consider checking if guild.members.me exists before calling permissionsFor, or wrap this in a try-catch block.

Suggested change
c.permissionsFor(guild.members.me!).has(PermissionFlagsBits.SendMessages)
guild.members.me !== null &&
c.permissionsFor(guild.members.me).has(PermissionFlagsBits.SendMessages)

Copilot uses AI. Check for mistakes.
@ayane0857 ayane0857 requested a review from a team as a code owner December 16, 2025 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: High 優先度高め。 Status: Review Needed レビュー待ち。Waiting for review. Type: Enhancement About Enhancement.機能強化に関するもの。 Type: Publishing About publishing.公開に関するもの

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants