mirror of
				https://github.com/Rapptz/discord.py.git
				synced 2025-10-25 02:23:04 +00:00 
			
		
		
		
	Add typings for models for guilds, activities, and voice
This commit is contained in:
		
							
								
								
									
										108
									
								
								discord/types/activity.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										108
									
								
								discord/types/activity.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,108 @@ | |||||||
|  | """ | ||||||
|  | The MIT License (MIT) | ||||||
|  |  | ||||||
|  | Copyright (c) 2015-present Rapptz | ||||||
|  |  | ||||||
|  | Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  | copy of this software and associated documentation files (the "Software"), | ||||||
|  | to deal in the Software without restriction, including without limitation | ||||||
|  | the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  | and/or sell copies of the Software, and to permit persons to whom the | ||||||
|  | Software is furnished to do so, subject to the following conditions: | ||||||
|  |  | ||||||
|  | The above copyright notice and this permission notice shall be included in | ||||||
|  | all copies or substantial portions of the Software. | ||||||
|  |  | ||||||
|  | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||||
|  | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||||
|  | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||||
|  | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||||
|  | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||||
|  | DEALINGS IN THE SOFTWARE. | ||||||
|  | """ | ||||||
|  |  | ||||||
|  | from __future__ import annotations | ||||||
|  |  | ||||||
|  | from typing import List, Literal, Optional, TypedDict | ||||||
|  | from .user import PartialUser | ||||||
|  | from .snowflake import Snowflake | ||||||
|  |  | ||||||
|  |  | ||||||
|  | StatusType = Literal['idle', 'dnd', 'online', 'offline'] | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class PartialPresenceUpdate(TypedDict): | ||||||
|  |     user: PartialUser | ||||||
|  |     guild_id: Snowflake | ||||||
|  |     status: StatusType | ||||||
|  |     activities: List[Activity] | ||||||
|  |     client_status: ClientStatus | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class ClientStatus(TypedDict, total=False): | ||||||
|  |     desktop: bool | ||||||
|  |     mobile: bool | ||||||
|  |     web: bool | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class ActivityTimestamps(TypedDict, total=False): | ||||||
|  |     start: int | ||||||
|  |     end: int | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class ActivityParty(TypedDict, total=False): | ||||||
|  |     id: str | ||||||
|  |     size: List[int] | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class ActivityAssets(TypedDict, total=False): | ||||||
|  |     large_image: str | ||||||
|  |     large_text: str | ||||||
|  |     small_image: str | ||||||
|  |     small_text: str | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class ActivitySecrets(TypedDict, total=False): | ||||||
|  |     join: str | ||||||
|  |     spectate: str | ||||||
|  |     match: str | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class _ActivityEmojiOptional(TypedDict, total=False): | ||||||
|  |     id: Snowflake | ||||||
|  |     animated: bool | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class ActivityEmoji(_ActivityEmojiOptional): | ||||||
|  |     name: str | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class _SendableActivityOptional(TypedDict, total=False): | ||||||
|  |     url: Optional[str] | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ActivityType = Literal[0, 1, 2, 4, 5] | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class SendableActivity(_SendableActivityOptional): | ||||||
|  |     name: str | ||||||
|  |     type: ActivityType | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class _BaseActivity(SendableActivity): | ||||||
|  |     created_at: int | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Activity(_BaseActivity, total=False): | ||||||
|  |     state: Optional[str] | ||||||
|  |     details: Optional[str] | ||||||
|  |     timestamps: ActivityTimestamps | ||||||
|  |     assets: ActivityAssets | ||||||
|  |     party: ActivityParty | ||||||
|  |     application_id: Snowflake | ||||||
|  |     flags: int | ||||||
|  |     emoji: Optional[ActivityEmoji] | ||||||
|  |     secrets: ActivitySecrets | ||||||
|  |     session_id: Optional[str] | ||||||
|  |     instance: bool | ||||||
							
								
								
									
										132
									
								
								discord/types/guild.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										132
									
								
								discord/types/guild.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,132 @@ | |||||||
|  | """ | ||||||
|  | The MIT License (MIT) | ||||||
|  |  | ||||||
|  | Copyright (c) 2015-present Rapptz | ||||||
|  |  | ||||||
|  | Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  | copy of this software and associated documentation files (the "Software"), | ||||||
|  | to deal in the Software without restriction, including without limitation | ||||||
|  | the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  | and/or sell copies of the Software, and to permit persons to whom the | ||||||
|  | Software is furnished to do so, subject to the following conditions: | ||||||
|  |  | ||||||
|  | The above copyright notice and this permission notice shall be included in | ||||||
|  | all copies or substantial portions of the Software. | ||||||
|  |  | ||||||
|  | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||||
|  | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||||
|  | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||||
|  | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||||
|  | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||||
|  | DEALINGS IN THE SOFTWARE. | ||||||
|  | """ | ||||||
|  |  | ||||||
|  | from typing import List, Literal, Optional, TypedDict | ||||||
|  | from .snowflake import Snowflake | ||||||
|  | from .channel import GuildChannel | ||||||
|  | from .voice import PartialVoiceState | ||||||
|  | from .welcome_screen import WelcomeScreen | ||||||
|  | from .activity import PartialPresenceUpdate | ||||||
|  | from .role import Role | ||||||
|  | from .member import Member | ||||||
|  | from .emoji import Emoji | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class _UnavailableGuildOptional(TypedDict, total=False): | ||||||
|  |     unavailable: bool | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class UnavailableGuild(_UnavailableGuildOptional): | ||||||
|  |     id: Snowflake | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class _GuildOptional(TypedDict, total=False): | ||||||
|  |     icon_hash: Optional[str] | ||||||
|  |     owner: bool | ||||||
|  |     permissions: str | ||||||
|  |     widget_enabled: bool | ||||||
|  |     widget_channel_id: Optional[Snowflake] | ||||||
|  |     joined_at: Optional[str] | ||||||
|  |     large: bool | ||||||
|  |     member_count: int | ||||||
|  |     voice_states: List[PartialVoiceState] | ||||||
|  |     members: List[Member] | ||||||
|  |     channels: List[GuildChannel] | ||||||
|  |     presences: List[PartialPresenceUpdate] | ||||||
|  |     max_presences: Optional[int] | ||||||
|  |     max_members: int | ||||||
|  |     premium_subscription_count: int | ||||||
|  |     max_video_channel_users: int | ||||||
|  |  | ||||||
|  |  | ||||||
|  | DefaultMessageNotificationLevel = Literal[0, 1] | ||||||
|  | ExplicitContentFilterLevel = Literal[0, 1, 2] | ||||||
|  | MFALevel = Literal[0, 1] | ||||||
|  | VerificationLevel = Literal[0, 1, 2, 3, 4] | ||||||
|  | PremiumTier = Literal[0, 1, 2, 3] | ||||||
|  | GuildFeature = Literal[ | ||||||
|  |     'INVITE_SPLASH', | ||||||
|  |     'VIP_REGIONS', | ||||||
|  |     'VANITY_URL', | ||||||
|  |     'VERIFIED', | ||||||
|  |     'PARTNERED', | ||||||
|  |     'COMMUNITY', | ||||||
|  |     'COMMERCE', | ||||||
|  |     'NEWS', | ||||||
|  |     'DISCOVERABLE', | ||||||
|  |     'FEATURABLE', | ||||||
|  |     'ANIMATED_ICON', | ||||||
|  |     'BANNER', | ||||||
|  |     'WELCOME_SCREEN_ENABLED', | ||||||
|  |     'MEMBER_VERIFICATION_GATE_ENABLED', | ||||||
|  |     'PREVIEW_ENABLED', | ||||||
|  | ] | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class _BaseGuildPreview(UnavailableGuild): | ||||||
|  |     name: str | ||||||
|  |     icon: Optional[str] | ||||||
|  |     splash: Optional[str] | ||||||
|  |     discovery_splash: Optional[str] | ||||||
|  |     emojis: List[Emoji] | ||||||
|  |     features: List[GuildFeature] | ||||||
|  |     description: Optional[str] | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class _GuildPreviewUnique(TypedDict): | ||||||
|  |     approximate_member_count: int | ||||||
|  |     approximate_presence_count: int | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class GuildPreview(_BaseGuildPreview, _GuildPreviewUnique): | ||||||
|  |     ... | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Guild(_BaseGuildPreview, _GuildOptional): | ||||||
|  |     owner_id: Snowflake | ||||||
|  |     region: str | ||||||
|  |     afk_channel_id: Optional[Snowflake] | ||||||
|  |     afk_timeout: int | ||||||
|  |     verification_level: VerificationLevel | ||||||
|  |     default_message_notifications: DefaultMessageNotificationLevel | ||||||
|  |     explicit_content_filter: ExplicitContentFilterLevel | ||||||
|  |     roles: List[Role] | ||||||
|  |     mfa_level: MFALevel | ||||||
|  |     application_id: Optional[Snowflake] | ||||||
|  |     system_channel_id: Optional[Snowflake] | ||||||
|  |     system_channel_flags: int | ||||||
|  |     rules_channel_id: Optional[Snowflake] | ||||||
|  |     vanity_url_code: Optional[str] | ||||||
|  |     banner: Optional[str] | ||||||
|  |     premium_tier: PremiumTier | ||||||
|  |     preferred_locale: str | ||||||
|  |     public_updates_channel_id: Optional[Snowflake] | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class InviteGuild(Guild, total=False): | ||||||
|  |     welcome_screen: WelcomeScreen | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class GuildWithCounts(Guild, _GuildPreviewUnique): | ||||||
|  |     ... | ||||||
							
								
								
									
										49
									
								
								discord/types/role.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								discord/types/role.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | |||||||
|  | """ | ||||||
|  | The MIT License (MIT) | ||||||
|  |  | ||||||
|  | Copyright (c) 2015-present Rapptz | ||||||
|  |  | ||||||
|  | Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  | copy of this software and associated documentation files (the "Software"), | ||||||
|  | to deal in the Software without restriction, including without limitation | ||||||
|  | the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  | and/or sell copies of the Software, and to permit persons to whom the | ||||||
|  | Software is furnished to do so, subject to the following conditions: | ||||||
|  |  | ||||||
|  | The above copyright notice and this permission notice shall be included in | ||||||
|  | all copies or substantial portions of the Software. | ||||||
|  |  | ||||||
|  | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||||
|  | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||||
|  | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||||
|  | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||||
|  | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||||
|  | DEALINGS IN THE SOFTWARE. | ||||||
|  | """ | ||||||
|  |  | ||||||
|  | from __future__ import annotations | ||||||
|  |  | ||||||
|  | from typing import TypedDict | ||||||
|  | from .snowflake import Snowflake | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class _RoleOptional(TypedDict, total=False): | ||||||
|  |     tags: RoleTags | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Role(_RoleOptional): | ||||||
|  |     id: Snowflake | ||||||
|  |     name: str | ||||||
|  |     color: int | ||||||
|  |     hoist: bool | ||||||
|  |     position: int | ||||||
|  |     permissions: str | ||||||
|  |     managed: bool | ||||||
|  |     mentionable: bool | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class RoleTags(TypedDict, total=False): | ||||||
|  |     bot_id: Snowflake | ||||||
|  |     integration_id: Snowflake | ||||||
|  |     premium_subscriber: None | ||||||
							
								
								
									
										57
									
								
								discord/types/voice.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								discord/types/voice.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,57 @@ | |||||||
|  | """ | ||||||
|  | The MIT License (MIT) | ||||||
|  |  | ||||||
|  | Copyright (c) 2015-present Rapptz | ||||||
|  |  | ||||||
|  | Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  | copy of this software and associated documentation files (the "Software"), | ||||||
|  | to deal in the Software without restriction, including without limitation | ||||||
|  | the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  | and/or sell copies of the Software, and to permit persons to whom the | ||||||
|  | Software is furnished to do so, subject to the following conditions: | ||||||
|  |  | ||||||
|  | The above copyright notice and this permission notice shall be included in | ||||||
|  | all copies or substantial portions of the Software. | ||||||
|  |  | ||||||
|  | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||||
|  | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||||
|  | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||||
|  | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||||
|  | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||||
|  | DEALINGS IN THE SOFTWARE. | ||||||
|  | """ | ||||||
|  |  | ||||||
|  | from typing import Optional, TypedDict | ||||||
|  | from .snowflake import Snowflake | ||||||
|  | from .member import Member | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class _PartialVoiceStateOptional(TypedDict, total=False): | ||||||
|  |     member: Member | ||||||
|  |     self_stream: bool | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class PartialVoiceState(_PartialVoiceStateOptional): | ||||||
|  |     channel_id: Optional[Snowflake] | ||||||
|  |     user_id: Snowflake | ||||||
|  |     session_id: str | ||||||
|  |     deaf: bool | ||||||
|  |     mute: bool | ||||||
|  |     self_deaf: bool | ||||||
|  |     self_mute: bool | ||||||
|  |     self_video: bool | ||||||
|  |     suppress: bool | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class VoiceState(PartialVoiceState, total=False): | ||||||
|  |     guild_id: Snowflake | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class VoiceRegion(TypedDict): | ||||||
|  |     id: str | ||||||
|  |     name: str | ||||||
|  |     vip: bool | ||||||
|  |     optimal: bool | ||||||
|  |     deprecated: bool | ||||||
|  |     custom: bool | ||||||
							
								
								
									
										40
									
								
								discord/types/welcome_screen.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								discord/types/welcome_screen.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | |||||||
|  | """ | ||||||
|  | The MIT License (MIT) | ||||||
|  |  | ||||||
|  | Copyright (c) 2015-present Rapptz | ||||||
|  |  | ||||||
|  | Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  | copy of this software and associated documentation files (the "Software"), | ||||||
|  | to deal in the Software without restriction, including without limitation | ||||||
|  | the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  | and/or sell copies of the Software, and to permit persons to whom the | ||||||
|  | Software is furnished to do so, subject to the following conditions: | ||||||
|  |  | ||||||
|  | The above copyright notice and this permission notice shall be included in | ||||||
|  | all copies or substantial portions of the Software. | ||||||
|  |  | ||||||
|  | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||||
|  | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||||
|  | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||||
|  | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||||
|  | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||||
|  | DEALINGS IN THE SOFTWARE. | ||||||
|  | """ | ||||||
|  |  | ||||||
|  | from __future__ import annotations | ||||||
|  |  | ||||||
|  | from typing import List, Optional, TypedDict | ||||||
|  | from .snowflake import Snowflake | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class WelcomeScreen(TypedDict): | ||||||
|  |     description: str | ||||||
|  |     welcome_channels: List[WelcomeScreenChannel] | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class WelcomeScreenChannel(TypedDict): | ||||||
|  |     channel_id: Snowflake | ||||||
|  |     description: str | ||||||
|  |     emoji_id: Optional[Snowflake] | ||||||
|  |     emoji_name: Optional[str] | ||||||
		Reference in New Issue
	
	Block a user