Skip to content

Resources


channel

Channel dataclass

Bases: BaseResource


              flowchart TD
              scurrypy.resources.channel.Channel[Channel]
              scurrypy.resources.base_resource.BaseResource[BaseResource]

                              scurrypy.resources.base_resource.BaseResource --> scurrypy.resources.channel.Channel
                


              click scurrypy.resources.channel.Channel href "" "scurrypy.resources.channel.Channel"
              click scurrypy.resources.base_resource.BaseResource href "" "scurrypy.resources.base_resource.BaseResource"
            

Represents a Discord channel resource.

id: Snowflake instance-attribute

ID of the channel.

fetch async

Fetch the full channel data from Discord.

Returns:

delete async

Deletes this channel from the server.

Fires Channel Update if success, and Channel Delete (or Thread Delete if a thread).

Permissions

Requires MANAGE_CHANNELS if channel is a guild channel or MANAGE_THREADS if channel is a thread

follow async

Follow announcement channel to send messages to a target channel.

Fires Webhooks Update.

Permissions

Requires MANAGE_WEBHOOKS in the target channel

Parameters:

  • webhook_channel_id (Snowflake) –

    ID of target channel

Returns:

edit_guild_channel async

Edit this channel.

Fires Channel Update.

Note

If modifying a category, all child channels also fire ChannelUpdateEvent.

Permissions

Requires MANAGE_CHANNELS for the guild

Parameters:

Returns:

fetch_messages async

Fetches this channel's messages.

Permissions

Requires VIEW_CHANNEL and READ_MESSAGE_HISTORY

Parameters:

  • limit (int, default: 50 ) –

    Max number of messages to return. Range 1 - 100. Defaults to 50.

  • before (Snowflake, default: None ) –

    get messages before this message ID

  • after (Snowflake, default: None ) –

    get messages after this message ID

  • around (Snowflake, default: None ) –

    get messages around this message ID

Returns:

fetch_pins async

Get this channel's pinned messages.

Permissions

Requires VIEW_CHANNEL and READ_MESSAGE_HISTORY

Warning

Does not work on a GUILD_FORUM channel!

Parameters:

  • limit (int, default: 50 ) –

    Max number of pinned messages to return. Range 1 - 50. Defaults to 50.

  • before (str, default: None ) –

    get pinned messages before this ISO8601 timestamp

Returns:

  • JsonQuery –

    queried list of pinned messages

send async

Send a message to this channel.

Fires Message Create.

Permissions

Requires SEND_MESSAGES if in a guild channel.

Requires READ_MESSAGE_HISTORY of replying to another message.

Parameters:

  • message (str | MessagePart) –

    content as a string or MessagePart

  • suppress_embeds (bool, default: False ) –

    whether to suppress embeds. Defaults to False.

  • suppress_notifications (bool, default: False ) –

    whether to suppress notifications. Defaults to False.

  • is_voice_message (bool, default: False ) –

    whether this message is a voice message. Defaults to False.

  • is_components_v2 (bool, default: False ) –

    whether V2 components are in this message. Defaults to False.

Returns:

bulk_delete_messages async

Delete multiple messages in a single request.

Fires Bulk Message Delete.

Permissions

Requires MANAGE_MESSAGES

Important

Messages older than 2 weeks will not get deleted!

Note

Only available for GUILD_TEXT channels.

Parameters:

  • message_ids (list[Snowflake]) –

    IDs of the messages to delete. Range 2 to 100 (inclusive).

fetch_invites async

Fetch a list of invites for this channel.

Permissions

Requires MANAGE_CHANNELS

Note

Only usable on guild channels.

Returns:

create_invite async

Create a new invite for this channel.

Fires Invite Create.

Permissions

Requires CREATE_INSTANT_INVITE

Note

Only usable for guild channels.

Parameters:

Returns:

fetch_thread_member async

Fetch a thread member of the specified user ID from this thread.

Parameters:

  • user_id (Snowflake) –

    ID of the user to fetch

  • with_member (bool, default: False ) –

    whether to include the member object. Defaults to False.

Returns:

fetch_thread_members async

Fetch all members of this thread.

Warning

Requires the GUILD_MEMBERS privileged intent to use!

Warning

Starting in API v11, paginated results will always be returned.

Enable paginated results before v11 by setting with_member to True.

Parameters:

  • limit (int, default: 100 ) –

    Max number of thread members to return. Range 0 to 100 (inclusive). Defaults to 100.

  • after (Snowflake, default: None ) –

    members after this user ID

  • with_member (bool, default: False ) –

    whether to include the member object. Defaults to False.

Returns:

  • JsonQuery –

    queried list of thread members

create_thread_from_message async

Create a thread from a message (attached to the message).

Fires Thread Create and Message Update.

Note

Creates a PUBLIC_THREAD when created in a GUILD_TEXT channel.

Creates a ANNOUNCEMENT_THREAD when created in a GUILD_ANNOUNCEMENT channel

Parameters:

Returns:

create_thread_without_message async

Create a thread not connected to an existing message.

Fires Thread Create.

Parameters:

Returns:

edit_thread async

Edit this thread.

Fires Channel Update.

Permissions

Requires MANAGE_THREADS

Important

Requires archived be False or set to False.

Parameters:

Returns:

join_thread async

Add the bot to this thread.

Fires Thread Members Update and Thread Create.

Important

Requires the thread is NOT archived.

leave_thread async

Remove the bot from a thread.

Fires Thread Members Update.

Important

Requires the thread is NOT archived.

add_thread_member async

Add a user to this thread.

Fires Thread Members Update.

Important

Requires the thread is NOT archived.

Parameters:

  • user_id (Snowflake) –

    ID of the user to add

remove_thread_member async

Remove a user to this thread.

Fires Thread Members Update.

Permissions

Requires MANAGE_THREADS or thread creator if PRIVATE_THREAD

Important

Requires the thread is NOT archived.

Parameters:

  • user_id (Snowflake) –

    ID of the user to remove

fetch_public_archived_threads async

Fetch archived public threads in this channel.

Permissions

Requires READ_MESSAGE_HISTORY

Note

Returns PUBLIC_THREAD threads if this is a GUILD_TEXT channel. Returns ANNOUNCEMENT_THREAD if this is a GUILD_ANNOUNCEMENT channel.

Note

Threads are ordered by archive_timestamp in descending order.

Parameters:

  • before (str, default: None ) –

    threads archived before this timestamp

  • limit (int, default: None ) –

    max number of threads to fetch

Returns:

  • JsonQuery –

    queried public archived threads

fetch_private_archived_threads async

Fetch archived private threads in this channel.

Permissions

Requires READ_MESSAGE_HISTORY and MANAGE_THREADS

Note

Threads are ordered by archive_timestamp in descending order.

Parameters:

  • before (str, default: None ) –

    threads archived before this timestamp

  • limit (int, default: None ) –

    max numer of threads to fetch

Returns:

  • JsonQuery –

    queried private archived threads

fetch_joined_private_archived_threads async

Fetch archived private threads in this channel the bot has joined.

Permissions

Requires READ_MESSAGE_HISTORY

Note

Threads are ordered by their id in descending order.

Parameters:

  • before (str, default: None ) –

    threads archived before this timestamp

  • limit (int, default: None ) –

    max numer of threads to fetch

Returns:

  • JsonQuery –

    queried private archived threads