Skip to content
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

✨ 为 Webhook 中的 source_guild 和 source_channel 添加单独的类 #30

Merged
merged 5 commits into from
Jun 21, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions nonebot/adapters/discord/api/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2298,6 +2298,19 @@ class VoiceRegion(BaseModel):

# Webhook
# see https://discord.com/developers/docs/resources/webhook
class SourceGuild(BaseModel):
# partial guild object
id: Snowflake
name: str
icon: Optional[str]
Autuamn marked this conversation as resolved.
Show resolved Hide resolved


class SourceChannel(BaseModel):
# partial channel object
id: Snowflake
name: str


class Webhook(BaseModel):
"""Used to represent a webhook.

Expand All @@ -2312,9 +2325,8 @@ class Webhook(BaseModel):
avatar: Optional[str] = Field(...)
token: Missing[str] = UNSET
application_id: Optional[Snowflake] = Field(...)
source_guild: MissingOrNullable[Guild] = UNSET # partial guild object
# partial channel object
source_channel: MissingOrNullable[Channel] = UNSET
source_guild: Missing[SourceGuild] = UNSET
source_channel: Missing[SourceChannel] = UNSET
url: Missing[str] = UNSET


Expand Down
Loading