dico.model.channel module
- class dico.model.channel.Channel(client, resp, *, guild_id=None)
Bases:
DiscordObjectBaseRepresents a Discord channel.
Refer https://discord.com/developers/docs/resources/channel#channel-object-channel-structure for attributes of the channel object.
- modify(**kwargs)
Modifies channel.
Note
**kwargsvaries depending on the channel type.- Returns:
- delete(*, reason=None)
Deletes channel.
- create_message(*args, **kwargs)
Creates message.
Note
FileIO object passed to
fileorfilesparameter will be automatically closed when requesting, therefore it is recommended to pass file path.
Warning
You must pass at least one of
contentorembedorfileorfilesparameter.You can’t use
fileandfilesat the same time.
- Parameters:
content (Optional[str]) – Content of the message.
embed (Optional[Union[Embed, dict]]) – Embed of the message.
embeds (Optional[List[Union[Embed, dict]]]) – List of embeds of the message.
file (Optional[Union[io.FileIO, pathlib.Path, str]]) – File of the message.
files (Optional[List[Union[io.FileIO, pathlib.Path, str]]]) – Files of the message.
tts (Optional[bool]) – Whether to speak message.
allowed_mentions (Optional[Union[AllowedMentions, dict]]) –
AllowedMentionsto use for this request.message_reference (Optional[Union[Message, MessageReference, dict]]) – Message to reply.
component (Optional[Union[dict, Component]]) – Component of the message.
components (Optional[List[Union[dict, Component]]]) – List of components of the message.
sticker (Optional[Sticker]) – Sticker of the message.
stickers (Optional[List[Sticker]]) – Stickers of the message. Up to 3.
- Returns:
- property send
Alias of
create_message().
- bulk_delete_messages(*messages, reason=None)
Bulk deletes messages.
- Parameters:
messages – Messages to delete.
reason (Optional[str]) – Reason of the action.
- edit_permissions(overwrite, *, reason=None)
Edits permissions.
- create_invite(**kwargs)
Creates channel invite.
- Parameters:
max_age (Optional[int]) – Maximum age of the invite.
max_uses (Optional[int]) – Maximum use count of the invite.
temporary (Optional[bool]) – Whether this invite is temporary, meaning user will be kicked if role is not added.
unique (Optional[bool]) – Whether this invite is unique, meaning new code will be generated even if there is invite with same options.
target_type (Optional[Union[int, InviteTargetTypes]]) – Target type of the voice channel invite.
target_user – Target user of the invite.
target_application – Target application of the invite.
reason (Optional[str]) – Reason of the action.
- Returns:
- delete_permissions(overwrite, *, reason=None)
Deletes permissions.
- Parameters:
overwrite – Target overwrite to delete. Accepts ID of the user or role.
reason (Optional[str]) – Reason of the action.
- follow(target_channel)
Follows this channel to target channel. :param target_channel: Channel to receive published messages. :return:
FollowedChannel
- trigger_typing_indicator()
Triggers
<client> is typing...on channel.
- add_recipient(user, access_token, nick)
Adds recipient to the group DM.
- remove_recipient(user)
Removes recipient from the group DM.
- Parameters:
user – Recipient to remove.
- start_thread(message=None, *, name, auto_archive_duration, reason=None)
Starts new thread.
Note
If
messageparam is passed, type of thread will be always public regardless of what you’ve set to.
- join_thread()
Joins to thread.
- add_thread_member(user)
Adds member to thread.
- Parameters:
user – User to add.
- leave_thread()
Leaves thread.
- remove_thread_member(user)
Removes member from thread.
- Parameters:
user – User to remove.
- list_thread_members()
Returns list of members in thread.
- Returns:
List[
ThreadMember]
- list_public_archived_threads(*, before=None, limit=None)
Returns list of public archived threads in channel.
- Parameters:
before (Optional[Union[str, datetime.datetime]]) – Timestamp to show threads before.
limit (Optional[int]) – Limit of the number of the threads.
- Returns:
- list_private_archived_threads(*, before=None, limit=None)
Returns list of private archived threads in channel.
- Parameters:
before (Optional[Union[str, datetime.datetime]]) – Timestamp to show threads before.
limit (Optional[int]) – Limit of the number of the threads.
- Returns:
- list_joined_private_archived_threads(*, before=None, limit=None)
Returns list of private archived threads that bot joined in channel.
- Parameters:
before (Optional[Union[str, datetime.datetime]]) – Timestamp to show threads before.
limit (Optional[int]) – Limit of the number of the threads.
- Returns:
- to_position_param(position=None, lock_permissions=None, parent=None)
Exports channel object to dict as position parameter format.
- to_welcome_screen_channel(description, emoji=None)
Exports channel object to welcome screen object.
- Parameters:
description (str) – Description of the channel.
emoji – Emoji to use.
- Returns:
- property mention
The string that mentions channel.
- property guild
Guild that channel belongs to if applicable.
- is_messageable()
Checks if channel is able to send messages.
- Returns:
bool
- is_thread_channel()
Checks if channel is a thread.
- Returns:
bool
- property link
- raw
- id
- client
- class dico.model.channel.ChannelTypes(value)
Bases:
TypeBaseTypes of the channel.
- GUILD_TEXT = 0
- DM = 1
- GUILD_VOICE = 2
- GROUP_DM = 3
- GUILD_CATEGORY = 4
- GUILD_NEWS = 5
- GUILD_STORE = 6
- GUILD_NEWS_THREAD = 10
- GUILD_PUBLIC_THREAD = 11
- GUILD_PRIVATE_THREAD = 12
- GUILD_STAGE_VOICE = 13
- GUILD_DIRECTORY = 14
- GUILD_FORUM = 15
- class dico.model.channel.VideoQualityModes(value)
Bases:
TypeBaseTypes of the video quality modes.
- AUTO = 1
- FULL = 2
- class dico.model.channel.ChannelFlags(*args, **kwargs)
Bases:
FlagBase- PINNED = 2
- REQUIRE_TAG = 16
- class dico.model.channel.SortOrderTypes(value)
Bases:
TypeBase- LATEST_ACTIVITY = 0
- CREATION_DATE = 1
- class dico.model.channel.ForumLayoutTypes(value)
Bases:
TypeBase- NOT_SET = 0
- LIST_VIEW = 1
- GALLERY_VIEW = 2
- class dico.model.channel.SendOnlyChannel(client, channel_id)
Bases:
objectInternal class representing temporary messageable channel.
- send(*args, **kwargs)
- property link
- class dico.model.channel.Message(client, resp, *, guild_id=None, webhook_token=None, interaction_token=None, original_response=False)
Bases:
DiscordObjectBaseRepresents a Discord message.
Refer https://discord.com/developers/docs/resources/channel#message-object for attributes of the channel object.
- reply(content=None, **kwargs)
Replies to the message.
- Parameters:
content (Optional[str]) – Content of the message.
embed (Optional[Union[Embed, dict]]) – Embed of the message.
embeds (Optional[List[Union[Embed, dict]]]) – List of embeds of the message.
file (Optional[Union[io.FileIO, pathlib.Path, str]]) – File of the message.
files (Optional[List[Union[io.FileIO, pathlib.Path, str]]]) – Files of the message.
tts (Optional[bool]) – Whether to speak message.
allowed_mentions (Optional[Union[AllowedMentions, dict]]) –
AllowedMentionsto use for this request.component (Optional[Union[dict, Component]]) – Component of the message.
components (Optional[List[Union[dict, Component]]]) – List of components of the message.
sticker (Optional[Sticker]) – Sticker of the message.
stickers (Optional[List[Sticker]]) – Stickers of the message. Up to 3.
- Returns:
- edit(**kwargs)
Edits message.
- Parameters:
content (Optional[str]) – Content to edit.
embeds (Optional[List[Union[Embed, dict]]]) – Embeds to edit.
file (Optional[FILE_TYPE]) – File to add.
files (Optional[List[FILE_TYPE]]) – Files to add.
allowed_mentions (Optional[Union[AllowedMentions, dict]]) – Allowed mentions of the message.
attachments (Optional[List[Union[Attachment, dict]]]) – Attachments to keep.
component (Optional[Union[dict, Component]]) – Component of the message to edit.
components (Optional[List[Union[dict, Component]]]) – Components of the message to edit.
- Returns:
- create_reaction(emoji)
Creates reaction.
- delete_reaction(emoji, user='@me')
Deletes reaction.
- start_thread(*, name, auto_archive_duration, reason=None)
Starts new thread.
- property guild
Guild this message belongs to.
- property channel
Channel this message belongs to.
- property link
- raw
- id
- client
- class dico.model.channel.MessageTypes(value)
Bases:
TypeBaseTypes of the message.
- DEFAULT = 0
- RECIPIENT_ADD = 1
- RECIPIENT_REMOVE = 2
- CALL = 3
- CHANNEL_NAME_CHANGE = 4
- CHANNEL_ICON_CHANGE = 5
- CHANNEL_PINNED_MESSAGE = 6
- GUILD_MEMBER_JOIN = 7
- USER_PREMIUM_GUILD_SUBSCRIPTION = 8
- USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1 = 9
- USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2 = 10
- USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3 = 11
- CHANNEL_FOLLOW_ADD = 12
- GUILD_DISCOVERY_DISQUALIFIED = 14
- GUILD_DISCOVERY_REQUALIFIED = 15
- GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING = 16
- GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING = 17
- THREAD_CREATED = 18
- REPLY = 19
- APPLICATION_COMMAND = 20
- THREAD_STARTER_MESSAGE = 21
- GUILD_INVITE_REMINDER = 22
- CONTEXT_MENU_COMMAND = 23
- AUTO_MODERATION_ACTION = 24
- class dico.model.channel.MessageActivity(resp)
Bases:
objectRepresents Message Activity.
- Variables:
~.type (MessageActivityTypes) – Type of the message activity.
~.party_id (Optional[str]) – ID of the party.
- classmethod optional(resp)
- class dico.model.channel.MessageActivityTypes(value)
Bases:
TypeBaseTypes of the message activity.
- JOIN = 1
- SPECTATE = 2
- LISTEN = 3
- JOIN_REQUEST = 5
- class dico.model.channel.MessageFlags(*args, **kwargs)
Bases:
FlagBaseFlags of the message.
- CROSSPOSTED = 1
- IS_CROSSPOST = 2
- SUPPRESS_EMBEDS = 4
- SOURCE_MESSAGE_DELETED = 8
- URGENT = 16
- HAS_THREAD = 32
- EPHEMERAL = 64
- LOADING = 128
- FAILED_TO_MENTION_SOME_ROLES_IN_THREAD = 256
- class dico.model.channel.MessageReference(resp)
Bases:
objectRepresents Message Reference object.
- Variables:
~.message_id (Optiona[Snowflake]) – ID of the message to refer.
~.channel_id (Optiona[Snowflake]) – ID of the channel of the message to refer.
~.guild_id (Optiona[Snowflake]) – ID of the guild of the message to refer.
~.fail_if_not_exists (bool) – Whether to raise error if message to refer does not exist.
- to_dict()
Exports the instance to dict.
- Returns:
dict
- classmethod from_message(message, fail_if_not_exists=True)
Creates instance from message to refer.
- Parameters:
- Returns:
- classmethod from_id(**kwargs)
Alias of MessageReference(…). This is for internal usage.
- Returns:
- class dico.model.channel.FollowedChannel(client, resp)
Bases:
objectRepresents Followed Channel object.
- Variables:
- RESPONSE
alias of
Union[FollowedChannel,Awaitable[FollowedChannel]]
- property channel
Gets channel object from cache.
- class dico.model.channel.Overwrite(user=None, role=None, allow=0, deny=0, **kw)
Bases:
CopyableObject- to_dict()
- edit(**kwargs)
- classmethod create(resp)
- class dico.model.channel.ThreadMetadata(client, resp)
Bases:
object- classmethod optional(client, resp)
- class dico.model.channel.ThreadMember(client, resp)
Bases:
object- RESPONSE
alias of
Union[ThreadMember,Awaitable[ThreadMember]]
- RESPONSE_AS_LIST
alias of
Union[List[ThreadMember],Awaitable[List[ThreadMember]]]
- property user
- classmethod optional(client, resp)
- classmethod create(*args)
This is just a placeholder to prevent AttributeError.
- class dico.model.channel.Embed(*, title=None, description=None, url=None, timestamp=None, color=None, **kwargs)
Bases:
CopyableObject- classmethod create(resp)
- set_image(url=None, proxy_url=None, height=None, width=None)
- set_thumbnail(url=None, proxy_url=None, height=None, width=None)
- set_video(url=None, proxy_url=None, height=None, width=None)
- set_provider(name=None, url=None)
- set_author(name=None, url=None, icon_url=None, proxy_icon_url=None)
- add_field(name, value, inline=True)
- property remove_field
- to_dict()
- class dico.model.channel.EmbedThumbnail(resp)
Bases:
CopyableObject- to_dict()
- classmethod optional(resp)
- class dico.model.channel.EmbedVideo(resp)
Bases:
CopyableObject- to_dict()
- classmethod optional(resp)
- class dico.model.channel.EmbedImage(resp)
Bases:
CopyableObject- to_dict()
- classmethod optional(resp)
- class dico.model.channel.EmbedProvider(resp)
Bases:
CopyableObject- to_dict()
- classmethod optional(resp)
- class dico.model.channel.EmbedAuthor(resp)
Bases:
CopyableObject- to_dict()
- classmethod optional(resp)
Bases:
CopyableObject
- class dico.model.channel.EmbedField(resp)
Bases:
CopyableObject- to_dict()
- classmethod optional(resp)
- class dico.model.channel.Attachment(client, resp)
Bases:
object- download()
- save(target='')
- to_dict()
- class dico.model.channel.AllowedMentions(*, everyone=False, users=None, roles=None, replied_user=False)
Bases:
CopyableObject- to_dict(*, reply=False)
- class dico.model.channel.ListThreadsResponse(client, resp)
Bases:
object- RESPONSE
alias of
Union[ListThreadsResponse,Awaitable[ListThreadsResponse]]