discordapi.channel

Module Contents

Classes

Channel

Object which automatically sets the attribute based on a dict object.

DMChannel

Object which automatically sets the attribute based on a dict object.

GroupDMChannel

Object which automatically sets the attribute based on a dict object.

GuildChannel

Object which automatically sets the attribute based on a dict object.

GuildTextChannel

Object which automatically sets the attribute based on a dict object.

GuildVoiceChannel

Object which automatically sets the attribute based on a dict object.

Functions

get_channel(client, data, guild=None)

Returns a channel object that has a corresponding type with given data.

discordapi.channel.get_channel(client, data, guild=None)

Returns a channel object that has a corresponding type with given data.

Type is determined from ‘type’ key. If the object came from the proper source, its type should be integer. Exception occurs if it doesn’t.

This function only determines the correct subclass to make instance with. Rest of the initialization is done under __init__ from each classes.

Parameters
  • client (DiscordClient) – DiscordClient object which a generated object will use.

  • data (dict) – Dictionary containing channel object returned from Discord.

  • guild (Guild) – Guild object for generated object to use. Can be ommited if the channel is not included in a guild.

Returns

instance of Channel with corresponding type.

Return type

Channel

Raises

ValueError – Raised If the key ‘type’ is not included in data or not integer.

class discordapi.channel.Channel(client, data)

Bases: discordapi.dictobject.DictObject

Inheritance diagram of discordapi.channel.Channel

Object which automatically sets the attribute based on a dict object.

_json

The original dict object in which the class was constructed from.

Constructs the class from the data.

This automatically sets the attributes from the dict. additionally, keys in keylist will be set as an attribute with the value of None when the attribute doesn’t exist- this is to ensure that it won’t overwrite the existing keys when running __init__ in already initialized instance.

modify(self, postdata)
delete(self)
get_messages(self, limit=EMPTY, around=EMPTY, before=EMPTY, after=EMPTY)
get_message(self, id_)
send(self, content=EMPTY, tts=EMPTY, file=None, embeds=None, embed=None, allowed_mentions=EMPTY, reply_to=None, components=EMPTY)
edit_message(self, message, content=EMPTY, file=None, embeds=None, embed=None, flags=EMPTY, allowed_mentions=EMPTY, attachments=EMPTY, components=EMPTY)
delete_message(self, message)
delete_messages(self, messages)
typing(self)
get_pinned_messages(self)
pin_message(self, message)
unpin_message(self, message)
react(self, message, emoji, urlencoded=False)
delete_my_reaction(self, message, emoji, urlencoded=False)
delete_others_reaction(self, message, emoji, user, urlencoded=False)
get_reactions(self, message, emoji, limit=EMPTY, after=EMPTY, urlencoded=False)
delete_all_reactions(self, message)
delete_all_reactions_for_emoji(self, message, emoji, urlencoded=False)
_send_request(self, method, route, data=None, expected_code=None, raise_at_exc=True, baseurl=None, headers=None)
class discordapi.channel.DMChannel(client, data)

Bases: Channel

Inheritance diagram of discordapi.channel.DMChannel

Object which automatically sets the attribute based on a dict object.

_json

The original dict object in which the class was constructed from.

Constructs the class from the data.

This automatically sets the attributes from the dict. additionally, keys in keylist will be set as an attribute with the value of None when the attribute doesn’t exist- this is to ensure that it won’t overwrite the existing keys when running __init__ in already initialized instance.

class discordapi.channel.GroupDMChannel(client, data)

Bases: DMChannel

Inheritance diagram of discordapi.channel.GroupDMChannel

Object which automatically sets the attribute based on a dict object.

_json

The original dict object in which the class was constructed from.

Constructs the class from the data.

This automatically sets the attributes from the dict. additionally, keys in keylist will be set as an attribute with the value of None when the attribute doesn’t exist- this is to ensure that it won’t overwrite the existing keys when running __init__ in already initialized instance.

modify(self, name=EMPTY, icon=None)
class discordapi.channel.GuildChannel(client, data, guild=None)

Bases: Channel

Inheritance diagram of discordapi.channel.GuildChannel

Object which automatically sets the attribute based on a dict object.

_json

The original dict object in which the class was constructed from.

Constructs the class from the data.

This automatically sets the attributes from the dict. additionally, keys in keylist will be set as an attribute with the value of None when the attribute doesn’t exist- this is to ensure that it won’t overwrite the existing keys when running __init__ in already initialized instance.

get_parent(self)
edit_permission(self, id_, allow=EMPTY, deny=EMPTY, type=EMPTY)
remove_permission(self, id_)
get_invites(self)
invite(self, max_age=86400, max_uses=0, temporary=False, unique=False, target_type=EMPTY, target_user_id=EMPTY, target_application_id=EMPTY)
class discordapi.channel.GuildTextChannel(client, data, guild=None)

Bases: GuildChannel

Inheritance diagram of discordapi.channel.GuildTextChannel

Object which automatically sets the attribute based on a dict object.

_json

The original dict object in which the class was constructed from.

Constructs the class from the data.

This automatically sets the attributes from the dict. additionally, keys in keylist will be set as an attribute with the value of None when the attribute doesn’t exist- this is to ensure that it won’t overwrite the existing keys when running __init__ in already initialized instance.

modify(self, name=EMPTY, position=EMPTY, topic=EMPTY, nsfw=EMPTY, rate_limit_per_user=EMPTY, permission_overwrites=EMPTY, parent_id=EMPTY)
crosspost(self, message)
follow_news_channel(self, id_)
class discordapi.channel.GuildVoiceChannel(client, data, guild=None)

Bases: GuildChannel

Inheritance diagram of discordapi.channel.GuildVoiceChannel

Object which automatically sets the attribute based on a dict object.

_json

The original dict object in which the class was constructed from.

Constructs the class from the data.

This automatically sets the attributes from the dict. additionally, keys in keylist will be set as an attribute with the value of None when the attribute doesn’t exist- this is to ensure that it won’t overwrite the existing keys when running __init__ in already initialized instance.

modify(self, name=EMPTY, position=EMPTY, bitrate=EMPTY, user_limit=EMPTY, permission_overwrites=EMPTY, parent_id=EMPTY, rtc_region=EMPTY, video_quality_mode=EMPTY)
connect(self, mute=False, deaf=False, timeout=10)

Connects the bot to the voice channel.

This method will fire a Gateway event to initialize connection to the voice server, create DiscordVoiceClient object, add it to client.voice_clients and return the client. Please note that client would most likely not be ready to run when it gets returned- please check its availability using .is_ready method or .ready_to_run Event attribute. AudioPlayer will also check this.