LordBoos / discord_game

Home Assistant custom component to get online and game status of Discord users
MIT License
56 stars 7 forks source link

(More) problems with Intents? #23

Closed mariwing closed 3 years ago

mariwing commented 3 years ago

I am getting this error

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 197, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/discord_game/sensor.py", line 37, in async_setup_platform intents = discord.Intents.default() AttributeError: module 'discord' has no attribute 'Intents'

I have granted my bot the two new privliges mentioned in the recently updated readme.md. The stock Discord component works as my notifications shows up in the channel as before.

I am running Home Assistant 117.2 and Discord Game 3.3.1.

Any tips on what I can do to get back the game stats? Thanks!

LordBoos commented 3 years ago

This looks like dependency problem. Intents are supported from discord.py v1.5.0. While stock Discord component uses 1.4.1, Discord Game uses 1.5.1. Personally I'm able to use both components at the same time without issues. On HA restart, I can see in the log, that python installed discord.py 1.5.1.

Are you on hassio? You can try to disable the stock component, restart HA, then enable it and restart again.

mariwing commented 3 years ago

Thank you for your swift reply. I am using hassio. I tried your suggestion. After disabling the stock Discord component the Discord Game component started working again. Unfortunately after re-enabling stock Discord it again failed. I guess there is not much that can be done with this type of dependency conflict?

LordBoos commented 3 years ago

There is not much I can do from my side. This requires upgrading discord.py dependency in the Home Assistant Core project.

mariwing commented 3 years ago

Thank you for submitting the PR to the home assistant repo! And please disregard my first comment (I have deleted it) since I did not see the PR on my mobile. Great work :-)

LordBoos commented 3 years ago

I've opened PR to Home Assistant Core to upgrade dependency. I'll close this once it's merged.

LordBoos commented 3 years ago

PR was merged, this should be fixed in the next major version of HA.