OtakuMegane / DerpyBot

An active learning chatbot using Markov chains.
MIT License
5 stars 3 forks source link

AttributeError: 'TextChannel' object has no attribute 'is_private' #5

Closed ineptvirus closed 5 years ago

ineptvirus commented 5 years ago

Hi, I have updated python to 3.7 along with downloading latest of all modules. I believe discord.py had updated to v1.0 which changed a buuunch of stuff as shown here:

https://discordpy.readthedocs.io/en/latest/migrating.html#migrating-1-0

The first error I'm getting is as such:

>> [Discord] Message from #testing-channel: mirai show me the error please
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\client.py", line 255, in _run_event
    await coro(*args, **kwargs)
  File "D:\Mirai\DerpyBot-v0.9.3.7_dev\clients\discord_client\discord_client.py", line 91, in on_message
    if message.channel.is_private:
AttributeError: 'TextChannel' object has no attribute 'is_private'
[Discord] Message from #testing-channel: thanks

The problem is discord_client.py line 91 as shown in the error:

if message.channel.is_private:

This is old and apparently should be replaced with something like:

if message.channel.isinstance(channel, discord.abc.PrivateChannel)

But doesn't seem to be working in any way I try.. I'm pretty meh at writing code, I usually do disassembly so I'm using this program you made as a bit of practise :)

I'm going to keep working on a fix in my fork and I'll update this issue thread if I find one

-IneptV

ineptvirus commented 5 years ago

Ah I have progressed, changed line 91:

if message.channel.is_private:

to

if isinstance(message.channel, discord.abc.PrivateChannel):

Thought I had tried that but apparently not. Got a new error to solve but I will only make a new issue if it bugs me enough..

I will update my fork

:) -IneptV

OtakuMegane commented 5 years ago

Cool, glad that worked out quickly. I'll take a look at updating things since discord.py actually got a new release.