Open honzajavorek opened 1 year ago
Heyhey, I wasn't able to repro this on my end (I see creator_id
provided for both API request and gateway events for a newly created event). Is this still an issue?
@Auralytical I will check and confirm if it's still true. Also might try a different server if it's server-specific.
Following up @honzajavorek were you able to double check this? Closing the issue soon due to non-reproability
I have minimal reproducible example working: example.zip
poetry install
export DISCORD_API_KEY='...'
export DISCORD_GUILD_ID='...'
to change guild IDpoetry run python creator_id.py
guild_scheduled_events
. As the subsequent code (client.get_guild()
or guild.scheduled_events
) doesn't require awaiting asynchronous responses, I presume that pycord hydrates data about events from this initial payload.{'test': None, 'status': 1, 'sku_ids': [], 'scheduled_start_time': '2023-12-19T17:00:00+00:00', 'scheduled_end_time': '2023-12-19T18:00:00+00:00', 'recurrence_rule': None, 'privacy_level': 2, 'name': 'Dominika Pražáková – Směrem k úspěchu aneb jak vykročit tou správnou nohou', 'image': 'd69fa5014d3b0d1a52173ead2e6c6b3e', 'id': '1148621846992924714', 'guild_scheduled_event_exceptions': [], 'guild_id': '769966886598737931', 'entity_type': 1, 'entity_metadata': {'speaker_ids': []}, 'entity_id': None, 'description': 'Jak se zorientovat v novém pracovním prostředí? Jak číst firemní kulturu, co nejrychleji zapadnout a přinést novému týmu přidanou hodnotu? Co dělat pro to, aby mě práce naplňovala a nestresovala? Jak efektivně komunikovat v týmu a jak porozumět tomu, co se ode mě očekává? Jak to dělat při práci na dálku? A jak na zpětnou vazbu? Přijďte na uvolněné povídání s Dominikou!\n\n(bude upřesněno)\n\nhttps://junior.guru/events/38/', 'channel_id': '1075814161138860135', 'auto_start': False}
creator_id
in the data.ScheduledEvent
class expects creator_id
key in the data:
self.creator_id = data.get("creator_id", None)
If I locally manually edit pycord's code and add some debugging lines, I can see that the data
doesn't contain creator_id
key at all. The code is defensive about expecting the creator_id
, because it was introduced later and old events could have be without it. The Discord API docs say nothing about recent events though.
INFO:creator_id:Logged in as kuře#7420
INFO:creator_id:Accessing guild 769966886598737931 (change this by setting DISCORD_GUILD_ID env var)
INFO:creator_id:Guild name: junior.guru
INFO:creator_id:Accessing scheduled events
INFO:creator_id:Scheduled event 1148621846992924714: Dominika Pražáková – Směrem k úspěchu aneb jak vykročit tou správnou nohou
INFO:creator_id:Creator ID: None
INFO:creator_id:Scheduled event 1148621848989409413: Míla Votradovec – (Šifrovačky, bude upřesněno)
INFO:creator_id:Creator ID: None
INFO:creator_id:Scheduled event 1152820873707913237: Praha: Mini sraz juniorů na akci React Girls
INFO:creator_id:Creator ID: None
INFO:creator_id:Scheduled event 1157739610630262854: Pondělní povídání
INFO:creator_id:Creator ID: None
INFO:creator_id:Scheduled event 1161156122548379649: České Budějovice: Mini sraz juniorů na akci jihočeské tech komunity
INFO:creator_id:Creator ID: None
INFO:creator_id:Scheduled event 1164417376473841745: Brno: Mini sraz juniorů na akci pythonistů (Pyvo)
INFO:creator_id:Creator ID: None
INFO:creator_id:Scheduled event 1165217474854277171: České Budějovice: Mini sraz juniorů na akci jihočeské tech komunity
INFO:creator_id:Creator ID: None
creator_id
properly set.I created completely new server (1166673072393289848, for the record) and authorized my bot (application 797097976571887687, for the record) to be an admin there. I created a sample event and tried to run the same code with the guild ID set to 1166673072393289848. The initial payload printed to my console looks like this:
...
'guild_scheduled_events': [{'test': None, 'status': 1, 'sku_ids': [], 'scheduled_start_time': '2023-12-24T12:00:00+00:00', 'scheduled_end_time': '2023-12-24T13:00:00+00:00', 'recurrence_rule': None, 'privacy_level': 2, 'name': 'Pokus', 'image': None, 'id': '1166675763718782997', 'guild_scheduled_event_exceptions': [], 'guild_id': '1166673072393289848', 'entity_type': 3, 'entity_metadata': {'location': 'Praha'}, 'entity_id': None, 'description': 'Tralala', 'channel_id': None, 'auto_start': False}]
...
The result is, again, no creator_id
set:
INFO:creator_id:Logged in as kuře#7420
INFO:creator_id:Accessing guild 1166673072393289848 (change this by setting DISCORD_GUILD_ID env var)
INFO:creator_id:Guild name: Kurník
INFO:creator_id:Accessing scheduled events
INFO:creator_id:Scheduled event 1166675763718782997: Pokus
INFO:creator_id:Creator ID: None
FWIW, if you're not up to running the code, the initial logs go like below. When I mention initial payload in my previous comments, what I mean is the content of the WebSocket Event: {'t': 'GUILD_CREATE'
lines.
DEBUG:asyncio:Using selector: KqueueSelector
WARNING:discord.client:PyNaCl is not installed, voice will NOT be supported
DEBUG:discord.client:on_ready has successfully been registered as an event
INFO:discord.client:logging in using static token
DEBUG:discord.http:GET https://discord.com/api/v10/users/@me with None has returned 200
DEBUG:discord.http:GET https://discord.com/api/v10/users/@me has received {'id': '797097976571887687', 'username': 'kuře', 'avatar': '47ed1251b517a153e95fc4345d22883c', 'discriminator': '7420', 'public_flags': 0, 'premium_type': 0, 'flags': 0, 'bot': True, 'banner': None, 'accent_color': None, 'global_name': None, 'avatar_decoration_data': None, 'banner_color': None, 'mfa_enabled': True, 'locale': 'en-US', 'email': None, 'verified': True, 'bio': ''}
DEBUG:discord.http:GET https://discord.com/api/v10/gateway with None has returned 200
DEBUG:discord.http:GET https://discord.com/api/v10/gateway has received {'url': 'wss://gateway.discord.gg'}
DEBUG:discord.gateway:Created websocket connected to wss://gateway.discord.gg?encoding=json&v=10&compress=zlib-stream
DEBUG:discord.gateway:For Shard ID None: WebSocket Event: {'t': None, 's': None, 'op': 10, 'd': {'heartbeat_interval': 41250, '_trace': ['["gateway-prd-us-east1-b-tsk4",{"micros":0.0}]']}}
INFO:discord.gateway:Shard ID None has sent the IDENTIFY payload.
DEBUG:discord.gateway:For Shard ID None: WebSocket Event: {'t': None, 's': None, 'op': 11, 'd': None}
DEBUG:discord.gateway:For Shard ID None: WebSocket Event: {'t': 'READY', 's': 1, 'op': 0, 'd': {'v': 10, 'user_settings': {}, 'user': {'verified': True, 'username': 'kuře', 'mfa_enabled': True, 'id': '797097976571887687', 'global_name': None, 'flags': 0, 'email': None, 'discriminator': '7420', 'bot': True, 'avatar': '47ed1251b517a153e95fc4345d22883c'}, 'session_type': 'normal', 'session_id': '=== REDACTED ===', 'resume_gateway_url': 'wss://gateway-us-east1-b.discord.gg', 'relationships': [], 'private_channels': [], 'presences': [], 'guilds': [{'unavailable': True, 'id': '769966886598737931'}, {'unavailable': True, 'id': '1166673072393289848'}], 'guild_join_requests': [], 'geo_ordered_rtc_regions': ['frankfurt', 'milan', 'rotterdam', 'stockholm', 'bucharest'], 'auth': {}, 'application': {'id': '797097976571887687', 'flags': 557056}, '_trace': ['=== REDACTED ===']}}
DEBUG:discord.client:Dispatching event socket_event_type
INFO:discord.gateway:Shard ID None has connected to Gateway: === REDACTED ===
DEBUG:discord.client:Dispatching event connect
DEBUG:discord.gateway:For Shard ID None: WebSocket Event: {'t': 'GUILD_CREATE', 's': 2, 'op': 0, 'd': {'lazy': True, 'embedded_activities': [], 'members': [... === REDACTED ===}
DEBUG:discord.client:Dispatching event socket_event_type
DEBUG:discord.client:Dispatching event guild_available
DEBUG:discord.gateway:For Shard ID None: WebSocket Event: {'t': 'GUILD_CREATE', 's': 3, 'op': 0, 'd': {'lazy': True, 'embedded_activities': [], 'members': [... === REDACTED ===}
I can confirm that this is a problem for initial connections and certain other events. For now, until we get a fix out, you should be able to get the creator id of the event using the GET endpoint
Thanks!
On Thu 26. 10. 2023 at 21:08, Austin Keener @.***> wrote:
I can confirm that this is a problem for initial connections and certain other events.
— Reply to this email directly, view it on GitHub https://github.com/discord/discord-api-docs/issues/6481#issuecomment-1781745485, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACFGMK3KJI43KBGK5LZDFTYBKYKRAVCNFSM6AAAAAA54OW5ZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBRG42DKNBYGU . You are receiving this because you were mentioned.Message ID: @.***>
Description
The API returns scheduled events from my guild with no
creator_id
, although those are recently created events and although this has worked a few days before. I made no changes to my code and it started crashing, because it assumed creator_id is always populated (I know it's optional, but only for very old events).Steps to Reproduce
I made my bot so that it only enriches my own guild, hence I cannot confirm if this is guild-specific or not. I use pycord:
I'm sure it's bug of the API, because I locally modified pycord's files so that the
ScheduledEvent
object logs whatever data it is initialized to my terminal and I could see the raw data. There is nocreator_id
at all for any of the current 14 events scheduled in my guild.Expected Behavior
The scheduled events should have creator ID unless they're very old, per documentation.
Current Behavior
There is no key
creator_id
in the raw data received from the API for any of the scheduled events in my guild.Screenshots/Videos
No response
Client and System Information
I have the following in my
pyproject.toml
:The whole repo is here, but it's a huge heap of code. I'll happily navigate you through it if desired though.
Possibly Related Issues
I found https://github.com/discord/discord-api-docs/issues/5352 and https://github.com/discord/discord-api-docs/issues/5940, but those look like old issues. This seems to be something introduced to the API just a few days ago.