Improved handling of larger event stages
This commit is contained in:
@@ -329,17 +329,25 @@ class CogEvent(Cog):
|
||||
|
||||
# TODO Make a nice message
|
||||
stages_string: str = "\n\n".join(
|
||||
f"**Stage {stage.sequence+1}**\nQuestion: {stage.question}\nAnswer: ||{stage.answer}||"
|
||||
for stage in stages
|
||||
f"**Stage {stage.sequence+1}**\nAnswer: ||{stage.answer}||" for stage in stages
|
||||
)
|
||||
|
||||
# TODO Show users registered for the event
|
||||
|
||||
# TODO Introduce i18n
|
||||
await ctx.respond(
|
||||
event_info_string: str = (
|
||||
f"**Event details**\n\nName: {pycord_event.name}\nStarts: <t:{get_unix_timestamp(starts_date)}>\nEnds: <t:{get_unix_timestamp(ends_date)}>\n\nStages:\n{stages_string}"
|
||||
)
|
||||
|
||||
chunk_size: int = 2000
|
||||
|
||||
event_info_chunks: List[str] = [
|
||||
event_info_string[i : i + chunk_size] for i in range(0, len(event_info_string), chunk_size)
|
||||
]
|
||||
|
||||
for chunk in event_info_chunks:
|
||||
await ctx.respond(chunk)
|
||||
|
||||
|
||||
def setup(bot: PycordBot) -> None:
|
||||
bot.add_cog(CogEvent(bot))
|
||||
|
Reference in New Issue
Block a user