diff --git a/discord/guild.py b/discord/guild.py index 60e8c9cd0..d25af2f09 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -4337,7 +4337,7 @@ class Guild(Hashable): """ data = await self._state.http.modify_guild_onboarding( 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, enabled=enabled if enabled is not MISSING else None, mode=mode.value if mode is not MISSING else None, diff --git a/discord/onboarding.py b/discord/onboarding.py index 50bfeddeb..4ca71b724 100644 --- a/discord/onboarding.py +++ b/discord/onboarding.py @@ -223,9 +223,9 @@ class PartialOnboardingPrompt: self.required: bool = required self.in_onboarding: bool = in_onboarding - def to_dict(self, *, id: int = MISSING) -> PromptPayload: + def to_dict(self, *, id: int) -> PromptPayload: return { - 'id': id or os.urandom(16).hex(), + 'id': id, 'type': self.type.value, 'title': self.title, 'options': [option.to_dict() for option in self.options], @@ -290,9 +290,6 @@ class OnboardingPrompt(PartialOnboardingPrompt, Hashable): def __repr__(self) -> str: return f'' - def to_dict(self) -> PromptPayload: - return super().to_dict(id=self.id) - class Onboarding: """Represents a guild's onboarding configuration.