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_id() int
make_user_dict(username: str, discrim: str | int, avatar: str | None, id_num: int = -1, flags: int = 0, *, bot: bool = ..., mfa_enabled: bool = ..., locale: str = ..., verified: bool = ..., email: str = ..., premium_type: int = ...) _types.JsonDict
dict_from_user(user: User) Dict[str, str | int | bool | Dict[str, JsonVal] | List[JsonVal]]
make_member_dict(guild: Guild, user: User, roles: List[int], joined: int = 0, deaf: bool = False, mute: bool = False, voice: bool = False, flags: int = 0, *, nick: str = ...) _types.JsonDict
dict_from_member(member: Member) Dict[str, str | int | bool | Dict[str, JsonVal] | List[JsonVal]]
make_role_dict(name: str, id_num: int = -1, colour: int = 0, color: int | None = None, hoist: bool = False, position: int = -1, permissions: int = 104324161, managed: bool = False, mentionable: bool = False) Dict[str, str | int | bool | Dict[str, JsonVal] | List[JsonVal]]
dict_from_role(role: Role) Dict[str, str | int | bool | Dict[str, JsonVal] | List[JsonVal]]
make_channel_dict(ctype: int, id_num: int = -1, *, guild_id: int = ..., position: int = ..., permission_overwrites: _types.JsonDict = ..., name: str = ..., topic: str | None = ..., nsfw: bool = ..., last_message_id: str | None = ..., bitrate: int = ..., user_limit: int = ..., rate_limit_per_user: int = ..., recipients: List[_types.JsonDict] = ..., icon: str | None = ..., owner_id: int = ..., application_id: int = ..., parent_id: int | None = ..., last_pin_timestamp: int = ...) _types.JsonDict
make_text_channel_dict(name: str, id_num: int = -1, guild_id: int = ..., position: int = ..., permission_overwrites: _types.JsonDict = ..., topic: str | None = ..., nsfw: bool = ..., last_message_id: int | None = ..., rate_limit_per_user: int = ..., parent_id: int | None = ..., last_pin_timestamp: int = ...) _types.JsonDict
make_category_channel_dict(name: str, id_num: int = -1, **kwargs: Any) Dict[str, str | int | bool | Dict[str, JsonVal] | List[JsonVal]]
make_dm_channel_dict(user: User, id_num: int = -1, **kwargs: Any) Dict[str, str | int | bool | Dict[str, JsonVal] | List[JsonVal]]
make_voice_channel_dict(name: str, id_num: int = -1, **kwargs: Any) Dict[str, str | int | bool | Dict[str, JsonVal] | List[JsonVal]]
dict_from_overwrite(target: Member | Role, overwrite: PermissionOverwrite) Dict[str, str | int | bool | Dict[str, JsonVal] | List[JsonVal]]
dict_from_channel(channel: TextChannel | CategoryChannel | GuildChannel | PrivateChannel) Dict[str, str | int | bool | Dict[str, JsonVal] | List[JsonVal]]
make_message_dict(channel: TextChannel | CategoryChannel | GuildChannel | PrivateChannel, author: BaseUser, id_num: int = -1, content: str = None, timestamp: int = None, edited_timestamp: int | None = None, tts: bool = False, mention_everyone: bool = False, mentions: List[User | Member] = None, mention_roles: List[int] = None, mention_channels: List[TextChannel | CategoryChannel | GuildChannel | PrivateChannel] = None, attachments: List[Attachment] = None, embeds: List[Embed] = None, pinned: bool = False, type: int = 0, *, guild_id: int = ..., member: Member = ..., reactions: List[Reaction] = ..., nonce: int | None = ..., webhook_id: int = ..., activity: Activity = ..., application: _types.JsonDict = ...) _types.JsonDict
dict_from_message(message: Message) Dict[str, 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: int | None = None, width: int | None = None, content_type: str | None = None) Dict[str, str | int | bool | Dict[str, JsonVal] | List[JsonVal]]
dict_from_attachment(attachment: Attachment) Dict[str, 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[_types.JsonDict], id_num: int = -1, emojis: List[_types.JsonDict] = None, icon: str | None = None, splash: str | None = 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[VoiceState] = ..., members: List[Member] = ..., channels: List[GuildChannel] = ..., presences: List[Activity] = ...) _types.JsonDict
dict_from_guild(guild: Guild) Dict[str, str | int | bool | Dict[str, JsonVal] | List[JsonVal]]