def get_events_channel(self, guild):
"""Return the events channel if it exists, otherwise create one and return it"""
for channel in guild.channels:
if channel.name == "upcoming-events":
return channel
# Need to make sure the bot can still send messages in the events channel
overwrites = {
guild.default_role: discord.PermissionOverwrite(send_messages=False, add_reactions=True),
guild.me: discord.PermissionOverwrite(send_messages=True, add_reactions=True)
}
return await guild.create_text_channel("upcoming-events", overwrites=overwrites)
评论列表
文章目录