python - discord.py logs_from not working -
i trying lot of messages server, making test scripts, , logs_from() not working how think should, dont know if im using wrong or what, using python 3.5, , recent version of discord.py on pypi
@client.event @asyncio.coroutine def on_message(message): number = 200 x = client.logs_from(message.channel, limit = number) print(x[1])
and error
typeerror: 'logsfromiterator' object not support indexing
client.logs_from
coroutine, meaning must first await it. returns iterator, not list, should iterate through it, instead of indexing it.
python 3.5 example:
async def get_logs_from(channel): async m in client.logs_from(channel): print(m.clean_content)
python 3.4 example:
@asyncio.coroutine def get_logs_from(channel): logs = yield client.logs_from(channel): m in logs: print(m.clean_content)
Comments
Post a Comment