Fixed categories and some timestamps
This commit is contained in:
@@ -303,7 +303,7 @@ class PycordBot(LibPycordBot):
|
|||||||
event_name: Optional[str] = None,
|
event_name: Optional[str] = None,
|
||||||
guild_id: Optional[int] = None,
|
guild_id: Optional[int] = None,
|
||||||
) -> PycordEvent:
|
) -> 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")
|
raise AttributeError("Either event ID or name with guild ID must be provided")
|
||||||
|
|
||||||
if event_id is not None:
|
if event_id is not None:
|
||||||
|
@@ -305,7 +305,7 @@ class PycordUser:
|
|||||||
|
|
||||||
channel: TextChannel = await guild.create_text_channel(
|
channel: TextChannel = await guild.create_text_channel(
|
||||||
f"{discord_member.name}_{shake_256(str(pycord_event._id).encode()).hexdigest(3)}",
|
f"{discord_member.name}_{shake_256(str(pycord_event._id).encode()).hexdigest(3)}",
|
||||||
category=discord_category,
|
category=discord_category.category,
|
||||||
overwrites=permission_overwrites,
|
overwrites=permission_overwrites,
|
||||||
reason=f"Event channel of {self.id} for event {pycord_event._id}",
|
reason=f"Event channel of {self.id} for event {pycord_event._id}",
|
||||||
)
|
)
|
||||||
|
@@ -101,7 +101,8 @@ class CogEvent(Cog):
|
|||||||
)
|
)
|
||||||
return
|
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]] = (
|
processed_media: List[Dict[str, Any]] = (
|
||||||
[] if thumbnail is None else await self.bot.process_attachments([thumbnail])
|
[] if thumbnail is None else await self.bot.process_attachments([thumbnail])
|
||||||
@@ -118,7 +119,7 @@ class CogEvent(Cog):
|
|||||||
|
|
||||||
# TODO Introduce i18n
|
# TODO Introduce i18n
|
||||||
await ctx.respond(
|
await ctx.respond(
|
||||||
f"Event **{event.name}** has been created and will take place <t:{get_unix_timestamp(event.starts)}:R>."
|
f"Event **{event.name}** has been created and will take place <t:{get_unix_timestamp(event.starts, to_utc=True)}:R>."
|
||||||
)
|
)
|
||||||
|
|
||||||
@command_group.command(
|
@command_group.command(
|
||||||
@@ -211,7 +212,8 @@ class CogEvent(Cog):
|
|||||||
await ctx.respond("Could not parse the end date.")
|
await ctx.respond("Could not parse the end date.")
|
||||||
return
|
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]] = (
|
processed_media: List[Dict[str, Any]] = (
|
||||||
[] if thumbnail is None else await self.bot.process_attachments([thumbnail])
|
[] if thumbnail is None else await self.bot.process_attachments([thumbnail])
|
||||||
@@ -229,7 +231,7 @@ class CogEvent(Cog):
|
|||||||
|
|
||||||
# TODO Make a nice message
|
# TODO Make a nice message
|
||||||
await ctx.respond(
|
await ctx.respond(
|
||||||
f"Event **{pycord_event.name}** has been updated and will take place <t:{get_unix_timestamp(pycord_event.starts)}:R>."
|
f"Event **{pycord_event.name}** has been updated and will take place <t:{get_unix_timestamp(pycord_event.starts, to_utc=True)}:R>."
|
||||||
)
|
)
|
||||||
|
|
||||||
@command_group.command(
|
@command_group.command(
|
||||||
|
@@ -68,7 +68,7 @@ class CogRegister(Cog):
|
|||||||
|
|
||||||
# TODO Make a nice message
|
# TODO Make a nice message
|
||||||
await ctx.respond(
|
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 <t:{get_unix_timestamp(pycord_event.starts)}:R>. 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 <t:{get_unix_timestamp(pycord_event.starts, to_utc=True)}:R>. Good luck!"
|
||||||
)
|
)
|
||||||
|
|
||||||
if pycord_event.starts.replace(tzinfo=ZoneInfo("UTC")) < datetime.now(tz=ZoneInfo("UTC")):
|
if pycord_event.starts.replace(tzinfo=ZoneInfo("UTC")) < datetime.now(tz=ZoneInfo("UTC")):
|
||||||
|
Reference in New Issue
Block a user