When a song progresses to a different one on Spotify, on_member_update is called, but before == after, and before.activities == after.activities.
Seems to be caused by hashing the session id, which doesn't change between songs.
@bot.event
async def on_member_update(b,a)
print(b==a)
print(b.activities == a.activities)
False
False
True
True
Doing a quick check reveals that comparing Member only compares the member ID and nothing else, as written here.
Assuming Member.activities has only an instance of Spotify, comparing the two only compares the session ID, as written here.
A simple way to represent this is:
class MyClass:
def __init__(self):
self.id = 5
self.something_else = 2
def __eq__(self, other):
return self.id == other.id
my_list = [MyClass()]
m = MyClass()
m.something_else = 6
my_other_list = [m]
print(my_list == my_other_list) # True because both instances of MyClass have the same ID
A way to work around this would be to compare the track_id of the Spotify instances instead.
The behaviour of Member.__eq__ is not going to change.
However, the behaviour of Spotify.__eq__ could be better I suppose.