Browse Source

Fix prompt ID code

pull/9260/head
Josh 2 years ago
parent
commit
025d099379
  1. 2
      discord/guild.py
  2. 7
      discord/onboarding.py

2
discord/guild.py

@ -4337,7 +4337,7 @@ class Guild(Hashable):
""" """
data = await self._state.http.modify_guild_onboarding( data = await self._state.http.modify_guild_onboarding(
self.id, self.id,
prompts=[p.to_dict() for p in prompts] if prompts is not MISSING else None, prompts=[p.to_dict(id=i) for i, p in enumerate(prompts)] if prompts is not MISSING else None,
default_channel_ids=[c.id for c in default_channels] if default_channels is not MISSING else None, default_channel_ids=[c.id for c in default_channels] if default_channels is not MISSING else None,
enabled=enabled if enabled is not MISSING else None, enabled=enabled if enabled is not MISSING else None,
mode=mode.value if mode is not MISSING else None, mode=mode.value if mode is not MISSING else None,

7
discord/onboarding.py

@ -223,9 +223,9 @@ class PartialOnboardingPrompt:
self.required: bool = required self.required: bool = required
self.in_onboarding: bool = in_onboarding self.in_onboarding: bool = in_onboarding
def to_dict(self, *, id: int = MISSING) -> PromptPayload: def to_dict(self, *, id: int) -> PromptPayload:
return { return {
'id': id or os.urandom(16).hex(), 'id': id,
'type': self.type.value, 'type': self.type.value,
'title': self.title, 'title': self.title,
'options': [option.to_dict() for option in self.options], 'options': [option.to_dict() for option in self.options],
@ -290,9 +290,6 @@ class OnboardingPrompt(PartialOnboardingPrompt, Hashable):
def __repr__(self) -> str: def __repr__(self) -> str:
return f'<OnboardingPrompt id={self.id} title={self.title}, type={self.type}>' return f'<OnboardingPrompt id={self.id} title={self.title}, type={self.type}>'
def to_dict(self) -> PromptPayload:
return super().to_dict(id=self.id)
class Onboarding: class Onboarding:
"""Represents a guild's onboarding configuration. """Represents a guild's onboarding configuration.

Loading…
Cancel
Save