Properly map truths, again
All checks were successful
Build and Publish college-bot-v2 / build_and_publish (push) Successful in 13s

This commit is contained in:
Nexus 2024-06-05 03:02:50 +01:00
parent 9c76fb7030
commit c3940daa96
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -284,13 +284,12 @@ class QuoteQuota(commands.Cog):
async def _process_all_messages( async def _process_all_messages(
self, self,
channel: discord.TextChannel, truths: list[TruthPayload]
truths: list
) -> tuple[discord.Embed, discord.File]: ) -> tuple[discord.Embed, discord.File]:
""" """
Processes all the messages in the given channel. Processes all the messages in the given channel.
:param channel: The channel to process :param truths: The truths to process
:returns: The stats :returns: The stats
""" """
embed = discord.Embed(title="Truth Counts", color=discord.Color.blurple(), timestamp=discord.utils.utcnow()) embed = discord.Embed(title="Truth Counts", color=discord.Color.blurple(), timestamp=discord.utils.utcnow())
@ -353,7 +352,7 @@ class QuoteQuota(commands.Cog):
response.raise_for_status() response.raise_for_status()
truths: list[dict] = response.json() truths: list[dict] = response.json()
truths: list[TruthPayload] = list(map(lambda t: TruthPayload.model_validate(t), truths)) truths: list[TruthPayload] = list(map(lambda t: TruthPayload.model_validate(t), truths))
embed, file = await self._process_all_messages(channel, truths) embed, file = await self._process_all_messages(truths)
await ctx.edit(embed=embed, file=file) await ctx.edit(embed=embed, file=file)