diff --git a/classes/pycord_bot.py b/classes/pycord_bot.py index 02f0b38..cda9992 100644 --- a/classes/pycord_bot.py +++ b/classes/pycord_bot.py @@ -303,7 +303,7 @@ class PycordBot(LibPycordBot): event_name: Optional[str] = None, guild_id: Optional[int] = None, ) -> PycordEvent: - if event_id is None or (event_name is None and guild_id is None): + if event_id is None and (event_name is None or guild_id is None): raise AttributeError("Either event ID or name with guild ID must be provided") if event_id is not None: diff --git a/classes/pycord_user.py b/classes/pycord_user.py index 12c78e8..b0d8f44 100644 --- a/classes/pycord_user.py +++ b/classes/pycord_user.py @@ -305,7 +305,7 @@ class PycordUser: channel: TextChannel = await guild.create_text_channel( f"{discord_member.name}_{shake_256(str(pycord_event._id).encode()).hexdigest(3)}", - category=discord_category, + category=discord_category.category, overwrites=permission_overwrites, reason=f"Event channel of {self.id} for event {pycord_event._id}", ) diff --git a/cogs/cog_event.py b/cogs/cog_event.py index 7e1f6d9..2014904 100644 --- a/cogs/cog_event.py +++ b/cogs/cog_event.py @@ -101,7 +101,8 @@ class CogEvent(Cog): ) return - await validate_event_validity(ctx, name, start_date, end_date, guild_timezone) + if not await validate_event_validity(ctx, name, start_date, end_date, guild_timezone): + return processed_media: List[Dict[str, Any]] = ( [] if thumbnail is None else await self.bot.process_attachments([thumbnail]) @@ -118,7 +119,7 @@ class CogEvent(Cog): # TODO Introduce i18n await ctx.respond( - f"Event **{event.name}** has been created and will take place ." + f"Event **{event.name}** has been created and will take place ." ) @command_group.command( @@ -211,7 +212,8 @@ class CogEvent(Cog): await ctx.respond("Could not parse the end date.") return - await validate_event_validity(ctx, name, start_date, end_date, guild_timezone) + if not await validate_event_validity(ctx, name, start_date, end_date, guild_timezone): + return processed_media: List[Dict[str, Any]] = ( [] if thumbnail is None else await self.bot.process_attachments([thumbnail]) @@ -229,7 +231,7 @@ class CogEvent(Cog): # TODO Make a nice message await ctx.respond( - f"Event **{pycord_event.name}** has been updated and will take place ." + f"Event **{pycord_event.name}** has been updated and will take place ." ) @command_group.command( diff --git a/cogs/cog_register.py b/cogs/cog_register.py index 587192f..5416be3 100644 --- a/cogs/cog_register.py +++ b/cogs/cog_register.py @@ -68,7 +68,7 @@ class CogRegister(Cog): # TODO Make a nice message await ctx.respond( - f"You are now registered for the event **{pycord_event.name}**.\n\nNew channel will be created for you and further instructions will be provided as soon as the event starts . Good luck!" + f"You are now registered for the event **{pycord_event.name}**.\n\nNew channel will be created for you and further instructions will be provided as soon as the event starts . Good luck!" ) if pycord_event.starts.replace(tzinfo=ZoneInfo("UTC")) < datetime.now(tz=ZoneInfo("UTC")):