Skip to content

Conversation

@lambdan
Copy link
Contributor

@lambdan lambdan commented Dec 13, 2025

Been getting a few of these on timeplayed:

oblivionis-1  | 2025-12-13 14:08:23 ERROR    discord.client Ignoring exception in on_presence_update
oblivionis-1  | Traceback (most recent call last):
oblivionis-1  |   File "/app/.venv/lib/python3.13/site-packages/discord/client.py", line 449, in _run_event
oblivionis-1  |     await coro(*args, **kwargs)
oblivionis-1  |   File "/app/oblivionis/bot.py", line 90, in on_presence_update
oblivionis-1  |     if are_activities_equal(after_activity, before_activity):
oblivionis-1  |        ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
oblivionis-1  |   File "/app/oblivionis/bot.py", line 29, in are_activities_equal
oblivionis-1  |     return x.name == y.name and x.application_id == y.application_id
oblivionis-1  |                                 ^^^^^^^^^^^^^^^^
oblivionis-1  | AttributeError: 'Game' object has no attribute 'application_id'

Unsure what game, but this should fix it.

@lambdan
Copy link
Contributor Author

lambdan commented Dec 13, 2025

Or maybe it would be better to return False if both don't have activity_id 🤔 If they are equal, both should have it...

@Hamuko
Copy link
Owner

Hamuko commented Dec 13, 2025

My first idea is that either both have it or both don't have it, so I'd make the condition x.name == y.name and getattr(x, "application_id", None) == getattr(y, "application_id", None). If both have the same name and no application ID then they're equal. No idea if somehow some game has the same name but different IDs.

@lambdan
Copy link
Contributor Author

lambdan commented Dec 13, 2025

I'm thinking this maybe

x_name = getattr(x, "name", "x")
y_name = getattr(y, "name", "y")
x_app_id = getattr(x, "application_id", "x")
y_app_id = getattr(y, "application_id", "y")
return x_name == y_name and x_app_id == y_app_id

@Hamuko
Copy link
Owner

Hamuko commented Dec 13, 2025

Is intended that if both application IDs are Nonethat the comparison results to False?

@lambdan
Copy link
Contributor Author

lambdan commented Dec 13, 2025

Hmm yeah that's true... didn't quite think it through. I'll change to your idea (name == name and id|None == id|None)

Also gonna see if I can figure out what game is causing this (I have a feeling its Roblox or TLauncher because a new user joined recently and that's what they're playing...)

@Hamuko Hamuko merged commit 6604f60 into Hamuko:master Dec 13, 2025
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants