dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
665 stars 155 forks source link

A StreamIntegration is sometimes passed to on_integration_update #478

Closed LostXOR closed 1 year ago

LostXOR commented 1 year ago

Summary

A StreamIntegration object is sometimes passed to on_integration_update instead of an Integration object.

Reproduction Steps

Run the code below. Wait for the on_integration_update event to be called for a Twitch or YouTube integration. I'm not sure exactly when it's called, but it seemed to happen fairly often with guilds of large YouTubers. Look at what the code prints.

Code

import discord

client = discord.Client()

@client.event
async def on_integration_update(integration):
    print(type(integration).__name__) # Should always be "Integration" according to docs

client.run("<token>")

Expected Results

When an on_integration_update event occurs, the code should print:

Integration

According to the docs, the argument passed to on_integration_update should be an Integration.

Actual Results

If the integration is a Twitch or YouTube integration, the code prints:

StreamIntegration

System Information

- Python v3.10.6-final
- discord.py-self v2.0.0-alpha
    - discord.py-self pkg_resources: v2.0.0a2
- aiohttp v3.8.4
- system info: Linux 5.15.0-67-generic #74-Ubuntu SMP Wed Feb 22 14:14:39 UTC 2023

Checklist

Additional Information

No response

dolfies commented 1 year ago

A StreamIntegration is a subclass of Integration, so this is valid behavior.