mahtoid / DiscordChatExporterPy

A simple Discord chat exporter for Python Discord bots.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: 'NoneType' object has no attribute 'history'

the-jolley-boy opened this issue · comments

DiscordChatExporterPy Version

2.2.1

Discord Version

2.0.1

Bug Description

Been using your chat-exporter for a while and it has been great, had the issue when I upgraded to discord.py 2.0+ but fixed the issue and it had been running smoothly until today.

Was archiving as I normally do and for some reason it threw me a NoneType error which was very odd since other channels in the same category worked without a hitch. My guess is a perms issue but im not too sure, hoping maybe you would have some insight into this issue.

Thanks!

Bug Traceback

[2022-09-11 17:38:04] [ERROR ] discord.ext.commands.bot: Ignoring exception in command archivechannel
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 190, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\Administrator\Archiver.py", line 49, in archivechannel
transcript = await chat_exporter.export(ch)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\chat_exporter\chat_exporter.py", line 51, in export
await Transcript(
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\chat_exporter\construct\transcript.py", line 70, in export
self.messages = [message async for message in self.channel.history(limit=self.limit)]
AttributeError: 'NoneType' object has no attribute 'history'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 1347, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 986, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 199, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'history'

Additional Information

No response

Hey!

Just checking out the issue you faced, seems to be something to do with the TextChannel object you passed through perhaps wasn't cached(?). Quite unsure on how else/or even if an un-cached TextChannel relates to None.

I'm a little baffled, but it's not anything to do with chat-exporter but perhaps discord.py or a slip up by yourself (not sure how you pass the channel in).


had the issue when I upgraded to discord.py 2.0+ but fixed the issue and it had been running smoothly until today.

What issue was that?

My guess was an issue on discords end, not even discord.py. I think I may just accept that I cannot archive this channel since it is an issue that I only have faced on one channel and I have archived like 75+ by now without any issue.

Thanks for the reply I think I will just close this bug.