def on_guild_join(self, guild):
"""Send the bot introduction message when invited."""
self.logger.info('New guild: ' + guild.name)
if self.selfbot: return
try:
await self.send_message(guild.default_channel, join_msg)
except discord.Forbidden:
satisfied = False
c_count = 0
try_channels = list(guild.channels)
channel_count = len(try_channels) - 1
while not satisfied:
with suppress(discord.Forbidden, discord.HTTPException):
await self.send_message(try_channels[c_count], join_msg)
satisfied = True
if c_count > channel_count:
self.logger.warning('Couldn\'t announce join to guild ' + guild.name)
satisfied = True
c_count += 1
评论列表
文章目录