-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Guild Onboarding #9260
base: master
Are you sure you want to change the base?
Support Guild Onboarding #9260
Conversation
Co-authored-by: numbermaniac <[email protected]>
Co-authored-by: numbermaniac <[email protected]>
A few fields are missing, which I get: "enable_default_channels": true,
"enable_onboarding_prompts": true,
"onboarding_prompts_seen": {},
"onboarding_responses_seen": {},
"responses": [] This would belong to |
The guild features could be added to this PR too:
Also the audit log events: discord/discord-api-docs#6041 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably add support for the audit log stuff as well.
The fields of the prompt option have changed: discord/discord-api-docs#6479 Looks like the emoji isn't implemented at all for editing yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consistency
The name of some audit log actions have changed and 2 new actions have been added, see discord/discord-api-docs#6041 I think it doesn't make sense to change the name of the server guide actions too, because the description kept the same and so the current names are more meaningful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some comments
class Onboarding(TypedDict): | ||
guild_id: Snowflake | ||
prompts: list[Prompt] | ||
default_channel_ids: list[Snowflake] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default_channel_ids: list[Snowflake] | |
default_channel_ids: List[Snowflake] |
|
||
class Onboarding(TypedDict): | ||
guild_id: Snowflake | ||
prompts: list[Prompt] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prompts: list[Prompt] | |
prompts: List[Prompt] |
|
||
class Prompt(TypedDict): | ||
id: Snowflake | ||
options: list[PromptOption] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
options: list[PromptOption] | |
options: List[PromptOption] |
class PromptOption(TypedDict): | ||
id: Snowflake | ||
channel_ids: list[Snowflake] | ||
role_ids: list[Snowflake] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
role_ids: list[Snowflake] | |
role_ids: List[Snowflake] |
|
||
class PromptOption(TypedDict): | ||
id: Snowflake | ||
channel_ids: list[Snowflake] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
channel_ids: list[Snowflake] | |
channel_ids: List[Snowflake] |
|
||
from __future__ import annotations | ||
|
||
from typing import Literal, Optional, TypedDict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from typing import Literal, Optional, TypedDict | |
from typing import Literal, Optional, TypedDict, List |
def __init__( | ||
self, | ||
title: str, | ||
emoji: Union[Emoji, PartialEmoji, str], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docstring marks this as optional.
emoji: Union[Emoji, PartialEmoji, str], | |
emoji: Optional[Union[Emoji, PartialEmoji, str]], |
) -> None: | ||
self.title: str = title | ||
self.description: Optional[str] = description | ||
self.emoji: Union[PartialEmoji, Emoji, str] = emoji |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be parsing str
s into PartialEmoji
s.
self.emoji: Union[PartialEmoji, Emoji, str] = emoji | |
self.emoji: Optional[Union[PartialEmoji, Emoji]] = PartialEmoji.from_str(emoji) if isinstance(emoji, str) else emoji |
self.channel_ids: Set[int] = set(channel_ids or []) | ||
self.role_ids: Set[int] = set(role_ids or []) | ||
|
||
def to_dict(self, *, id: int = MISSING) -> PromptOptionPayload: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should also be updated for the change, using self.emoji._to_partial
then handling the rest
} | ||
|
||
return { | ||
'id': id or os.urandom(16).hex(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this be always MISSING
when no value is passed🤔? Shouldn't this be a id if id is not MISSING else os.urandom(16).hex()
?
Summary
This pull request implements support for the guild onboarding configuration.
Checklist