Factories¶
Module for (mostly) stateless creation/destructuring of discord.py objects. Primarily a utility for the rest of the library, which often needs to convert between objects and JSON at various stages.
- make_user_dict(username: str, discrim: Union[str, int], avatar: Optional[str], id_num: int = - 1, flags: int = 0, *, bot: bool = '...', mfa_enabled: bool = '...', locale: str = '...', verified: bool = '...', email: str = '...', premium_type: int = '...') → Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]¶
-
dict_from_user(user:
discord.User
) → Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]¶
-
make_member_dict(guild:
discord.Guild
, user:discord.User
, roles: List[int], joined: int = 0, deaf: bool = False, mute: bool = False, voice: bool = False, *, nick: str = '...') → Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]¶
-
dict_from_member(member:
discord.Member
) → Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]¶
- make_role_dict(name: str, id_num: int = - 1, colour: int = 0, color: Optional[int] = None, hoist: bool = False, position: int = - 1, permissions: int = 104324161, managed: bool = False, mentionable: bool = False) → Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]¶
-
dict_from_role(role:
discord.Role
) → Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]¶
- make_channel_dict(ctype: int, id_num: int = - 1, *, guild_id: int = '...', position: int = '...', permission_overwrites: Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]] = '...', name: str = '...', topic: Optional[str] = '...', nsfw: bool = '...', last_message_id: Optional[str] = '...', bitrate: int = '...', user_limit: int = '...', rate_limit_per_user: int = '...', recipients: List[Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]] = '...', icon: Optional[str] = '...', owner_id: int = '...', application_id: int = '...', parent_id: Optional[int] = '...', last_pin_timestamp: int = '...') → Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]¶
- make_text_channel_dict(name: str, id_num: int = - 1, guild_id: int = ..., position: int = ..., permission_overwrites: Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]] = ..., topic: Optional[str] = ..., nsfw: bool = ..., last_message_id: Optional[int] = ..., rate_limit_per_user: int = ..., parent_id: Optional[int] = ..., last_pin_timestamp: int = ...) → Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]¶
- make_category_channel_dict(name: str, id_num: int = - 1, **kwargs: Any) → Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]¶
-
make_dm_channel_dict(user:
discord.User
, id_num: int = - 1, **kwargs: Any) → Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]¶
-
dict_from_overwrite(target: Union[
discord.Member
,discord.Role
], overwrite:discord.PermissionOverwrite
) → Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]¶
-
dict_from_channel(channel: Union[
discord.TextChannel
,discord.CategoryChannel
, discord.abc.GuildChannel, discord.abc.PrivateChannel]) → Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]¶
-
make_message_dict(channel: Union[
discord.TextChannel
,discord.CategoryChannel
, discord.abc.GuildChannel, discord.abc.PrivateChannel], author: discord.user.BaseUser, id_num: int = - 1, content: str = None, timestamp: int = None, edited_timestamp: Optional[int] = None, tts: bool = False, mention_everyone: bool = False, mentions: List[Union[discord.User
,discord.Member
]] = None, mention_roles: List[int] = None, mention_channels: List[Union[discord.TextChannel
,discord.CategoryChannel
, discord.abc.GuildChannel, discord.abc.PrivateChannel]] = None, attachments: List[discord.Attachment
] = None, embeds: List[discord.Embed
] = None, pinned: bool = False, type: int = 0, *, guild_id: int = '...', member:discord.Member
= '...', reactions: List[discord.Reaction
] = '...', nonce: Optional[int] = '...', webhook_id: int = '...', activity:discord.Activity
= '...', application: Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]] = '...') → Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]¶
-
dict_from_message(message:
discord.Message
) → Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]¶
- make_attachment_dict(filename: str, size: int, url: str, proxy_url: str, id_num: int = - 1, height: Optional[int] = None, width: Optional[int] = None, content_type: Optional[int] = None) → Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]¶
-
dict_from_attachment(attachment:
discord.Attachment
) → Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]¶
- make_emoji_dict()¶
- dict_from_emoji(emoji)¶
-
make_guild_dict(name: str, owner_id: int, roles: List[Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]], id_num: int = - 1, emojis: List[Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]] = None, icon: Optional[str] = None, splash: Optional[str] = None, region: str = 'en_north', afk_channel_id: int = None, afk_timeout: int = 600, verification_level: int = 0, default_message_notifications: int = 0, explicit_content_filter: int = 0, features: List[str] = None, mfa_level: int = 0, application_id: int = None, system_channel_id: int = None, *, owner: bool = '...', permissions: int = '...', embed_enabled: bool = '...', embed_channel_id: int = '...', widget_enabled: bool = '...', widget_channel_id: int = '...', joined_at: int = '...', large: bool = '...', unavailable: bool = '...', member_count: int = '...', voice_states: List[
discord.VoiceState
] = '...', members: List[discord.Member
] = '...', channels: List[discord.abc.GuildChannel] = '...', presences: List[discord.Activity
] = '...') → Dict[str, Union[str, int, bool, Dict[str, JsonVal], List[JsonVal]]]¶