Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

fix: Converting before parameter of list_public_archived_threads() to ISO8601 #728

Merged
merged 3 commits into from
Nov 19, 2022

Conversation

kpodp0ra
Copy link
Contributor

What type of pull request is this?

  • Non-breaking code change
  • Breaking code change
  • Documentation change/addition
  • Tests change

Description

This PR fixes following error caused by forum.archived_posts() iterator

Traceback (most recent call last):
  File "naff/client/client.py", line 1832, in _dispatch_prefixed_commands
    await self._run_prefixed_command(command, context)
  File "naff/client/client.py", line 1655, in _run_prefixed_command
    return await command(ctx)
  File "naff/models/naff/command.py", line 120, in __call__
    await self.call_callback(self.callback, context)
  File "naff/models/naff/prefixed_commands.py", line 624, in call_callback
    return await self.call_with_binding(callback, ctx)
  File "naff/models/naff/callback.py", line 43, in call_with_binding
    return await callback(*args, **kwargs)
  File "bot/main.py", line 35, in test
    async for post in ch.archived_posts():
  File "naff/models/misc/iterator.py", line 75, in __anext__
    await self._get_items()
  File "naff/models/misc/iterator.py", line 67, in _get_items
    data = await self.fetch()
  File "naff/models/discord/channel.py", line 144, in fetch
    rcv = await self.channel._client.http.list_public_archived_threads(
  File "naff/api/http/http_requests/threads.py", line 96, in list_public_archived_threads
    payload["before"] = timestamp_converter(before)
  File "naff/client/utils/attr_converters.py", line 29, in timestamp_converter
    raise TypeError("Timestamp must be one of: datetime, int, float, ISO8601 str")
TypeError: Timestamp must be one of: datetime, int, float, ISO8601 str

Changes

  • Fixed fetching data in forums with more than 100 archived posts.

Checklist

  • I've formatted my code with Black
  • I've ensured my code works on Python 3.10.x
  • I've tested my code

naff/models/discord/channel.py Outdated Show resolved Hide resolved
@LordOfPolls
Copy link
Member

/ok-to-test

@LordOfPolls LordOfPolls merged commit a51e5b5 into NAFTeam:dev Nov 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants