Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ineptvirus opened this issue Apr 16, 2019 · 2 comments
Closed

Comments

@ineptvirus
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants