Fixed messages about not created channels
This commit is contained in:
@@ -98,10 +98,27 @@ class PycordBot(LibPycordBot):
|
||||
await user._set(self.cache, current_event_id=event._id, current_stage_id=first_stage._id)
|
||||
|
||||
# Create a channel for each participant
|
||||
await user.setup_event_channel(self, guild, pycord_guild, event, cache=self.cache)
|
||||
user_channel: TextChannel | None = await user.setup_event_channel(
|
||||
self, guild, pycord_guild, event, cache=self.cache
|
||||
)
|
||||
|
||||
# Send a notification about event start
|
||||
user_channel: TextChannel = guild.get_channel(user.event_channels[str(event._id)])
|
||||
if user_channel is None:
|
||||
logger.error(
|
||||
"Event channel was not created for user %s from guild %s and event %s after registration.",
|
||||
user.id,
|
||||
guild.id,
|
||||
event._id,
|
||||
)
|
||||
|
||||
discord_user: User = self.get_user(user.id)
|
||||
|
||||
await self.notify_admins(
|
||||
guild,
|
||||
pycord_guild,
|
||||
f"Event channel could not be created for user **{discord_user.display_name}** ({discord_user.mention}) and event **{event.name}**.",
|
||||
)
|
||||
|
||||
continue
|
||||
|
||||
thumbnail: File | None = (
|
||||
None
|
||||
@@ -109,8 +126,8 @@ class PycordBot(LibPycordBot):
|
||||
else File(Path(f"data/{event.thumbnail['id']}"), event.thumbnail["filename"])
|
||||
)
|
||||
|
||||
# Send a notification about event start
|
||||
# TODO Make a nice message
|
||||
# TODO Also send a thumbnail, event info and short explanation on how to play
|
||||
await user_channel.send(
|
||||
f"Event **{event.name}** is starting!\n\nUse slash command `/guess` to suggest your answers to each event stage.",
|
||||
file=thumbnail,
|
||||
|
Reference in New Issue
Block a user