dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
680 stars 161 forks source link

channel.history doesn't work #383

Closed theAbdoSabbagh closed 1 year ago

theAbdoSabbagh commented 1 year ago

Summary

Tried scraping some messages, got an error

Reproduction Steps

I used channel.history and got the issue.

Code

    channel = await bot.fetch_channel(ID)
    async for message in channel.history(limit = None, after = 1661976000):
        ...

Expected Results

It was supposed to work and iterate over the channel messages

Actual Results

Ignoring exception in on_ready
Traceback (most recent call last):
  File "C:\Users\.\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 396, in _run_event
    await coro(*args, **kwargs)
  File "hidden", line 38, in hidden
    async for message in channel.history(limit = None, after = 1661976000):
  File "C:\Users\.\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\abc.py", line 1847, in history
    data, state, limit = await strategy(retrieve, state, limit)
  File "C:\Users\aboud\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\abc.py", line 1776, in _after_strategy
    after_id = after.id if after else None
AttributeError: 'int' object has no attribute 'id'

System Information

Checklist

Additional Information

No response

theAbdoSabbagh commented 1 year ago

invalid, my bad, shoulda used datetime.datetime() instead of int