disco.types.channel

Constants

NSFW_RE = compile(^nsfw(-|$))
ChannelType = Enum(
  GUILD_TEXT = 0,
  DM = 1,
  GUILD_VOICE = 2,
  GROUP_DM = 3,
  GUILD_CATEGORY = 4)
PermissionOverwriteType = Enum(
  ROLE = role,
  MEMBER = member)

Classes

ChannelSubType

Inherits From SlottedModel

Functions

channel(self)

PermissionOverwrite

Inherits From ChannelSubType

A PermissionOverwrite for a :class:Channel.

Attributes
Name Type Description
id snowflake The overwrite ID
type :const:`disco.types.channel.PermissionsOverwriteType` The overwrite type
allowed :class:`PermissionValue` All allowed permissions
denied :class:`PermissionValue` All denied permissions

Functions

create_for_channel(cls, channel, entity, allow, deny=0)

compiled(self)

save(self,**kwargs)

delete(self,**kwargs)

Channel

Inherits From SlottedModel, Permissible

Represents a Discord Channel.

Attributes
Name Type Description
id snowflake The channel ID.
guild_id Optional[snowflake] The guild id this channel is part of.
name str The channel's name.
topic str The channel's topic.
position int The channel's position.
bitrate int The channel's bitrate. recipients: list(:class:`disco.types.user.User`) Members of this channel (if this is a DM channel).
type :const:`ChannelType` The type of this channel.
overwrites dict(snowflake, :class:`disco.types.channel.PermissionOverwrite`) Channel permissions overwrites.

Functions

init(self,*args,**kwargs)

after_load(self)

str(self)

repr(self)

get_permissions(self, user)

Get the permissions a user has in the channel.

Returns
Computed permission value for the user.

mention(self)

is_guild(self)

Whether this channel belongs to a guild.

is_dm(self)

Whether this channel is a DM (does not belong to a guild).

is_nsfw(self)

Whether this channel is an NSFW channel.

is_voice(self)

Whether this channel supports voice.

messages(self)

A default MessageIterator for the channel, can be used to quickly and easily iterate over the channels entire message history. For more control, use Channel.messages_iter.

guild(self)

Guild this channel belongs to (or None if not applicable).

parent(self)

Parent this channel belongs to (or None if not applicable).

messages_iter(self,**kwargs)

Creates a new MessageIterator for the channel with the given keyword

get_message(self, message)

Attempts to fetch and return a Message from the message object or id.

Returns
The fetched message

get_invites(self)

Returns
Returns a list of all invites for this channel.

create_invite(self,*args,**kwargs)

Attempts to create a new invite with the given arguments. For more information see Invite.create_for_channel.

Returns

get_pins(self)

Returns
Returns a list of all pinned messages for this channel.

create_pin(self, message)

Pins the given message to the channel.

Params
Name Type Description
message `Message`|snowflake The message or message ID to pin.

delete_pin(self, message)

Unpins the given message from the channel.

Params
Name Type Description
message `Message`|snowflake The message or message ID to pin.

get_webhooks(self)

Returns
Returns a list of all webhooks for this channel.

create_webhook(self,*args,**kwargs)

Creates a webhook for this channel. See APIClient.channels_webhooks_create for more information.

Returns
The created webhook.

send_message(self,*args,**kwargs)

Send a message to this channel. See APIClient.channels_messages_create for more information.

Returns
The created message.

connect(self,*args,**kwargs)

Connect to this channel over voice.

create_overwrite(self,*args,**kwargs)

Creates a PermissionOverwrite for this channel. See PermissionOverwrite.create_for_channel for more information.

delete_message(self, message)

Deletes a single message from this channel.

Args
Name Type Description
message snowflake|`Message` The message to delete.

delete_messages(self, messages)

Deletes a set of messages using the correct API route based on the number of messages passed.

Args
Name Type Description
messages list(snowflake|`Message`) List of messages (or message ids) to delete. All messages must originate from this channel.

delete(self,**kwargs)

close(self)

Closes a DM channel. This is intended as a safer version of delete, enforcing that the channel is actually a DM.

set_topic(self, topic, reason)

Sets the channels topic.

set_name(self, name, reason)

Sets the channels name.

set_position(self, position, reason)

Sets the channels position.

set_nsfw(self, value, reason)

Sets whether the channel is NSFW.

set_bitrate(self, bitrate, reason)

Sets the channels bitrate.

set_user_limit(self, user_limit, reason)

Sets the channels user limit.

set_parent(self, parent, reason)

Sets the channels parent.

create_text_channel(self,*args,**kwargs)

Creates a sub-text-channel in this category. See Guild.create_text_channel for arguments and more information.

create_voice_channel(self,*args,**kwargs)

Creates a sub-voice-channel in this category. See Guild.create_voice_channel for arguments and more information.

MessageIterator

An iterator which supports scanning through the messages for a channel.

Parameters
Name Type Description
client :class:`disco.client.Client` The disco client instance to use when making requests.
channel `Channel` The channel to iterate within.
direction :attr:`MessageIterator.Direction` The direction in which this iterator will move.
bulk bool If true, this iterator will yield messages in list batches, otherwise each message will be yield individually.
before snowflake The message to begin scanning at.
after snowflake The message to begin scanning at.
chunk_size int The number of messages to request per API call.

Functions

init(self, client, channel, direction, bulk=False, before=None, after=None, chunk_size=100)

fill(self)

Fills the internal buffer up with :class:disco.types.message.Message objects from the API.

Returns a boolean indicating whether items were added to the buffer.

next(self)

iter(self)

next(self)

results matching ""

    No results matching ""