Skip to content

Channel Resource

Note

The following classes come from the scurrypy.resources.channel module.


Channel dataclass

Bases: BaseResource

Represents a Discord guild channel.

id: int instance-attribute

ID of the channel.

context: Any instance-attribute

Associated user data.

fetch async

Fetch the full channel data from Discord.

Returns:

  • ChannelModel

    A new Channel object with all fields populated

fetch_messages async

Fetches this channel's messages.

Permissions
  • VIEW_CHANNEL → required to access channel messages
  • READ_MESSAGE_HISTORY → required for user, otherwise no messages are returned

Parameters:

  • **kwargs (Unpack[MessagesFetchParams], default: {} ) –

    message fetch params

    Note

    if no kwargs are provided, default to 50 fetched messages limit.

Returns:

send async

Send a message to this channel.

Permissions
  • SEND_MESSAGES → required to create a message in this channel

Parameters:

  • message (str | MessagePart) –

    can be just text or the MessagePart for dynamic messages

Returns:

edit async

Edit this channel's settings.

Permissions
  • MANAGE_CHANNELS → required to edit this channel

Parameters:

Returns:

create_thread_from_message async

Create a thread from this message

Parameters:

  • message_id (int) –

    ID of message to attach thread

  • name (str) –

    thread name

  • **kwargs (Unpack[ThreadFromMessageParams], default: {} ) –

    thread create params

Returns:

fetch_pins async

Get this channel's pinned messages.

Permissions
  • VIEW_CHANNEL → required to access pinned messages
  • READ_MESSAGE_HISTORY → required for reading pinned messages

Parameters:

  • **kwargs (Unpack[PinsFetchParams], default: {} ) –

    pinned message fetch params

    Note

    If no kwargs are provided, default to 50 fetched messages limit.

Returns:

  • list[PinnedMessage]

    list of pinned messages

delete async

Deletes this channel from the server.

Permissions
  • MANAGE_CHANNELS → required to delete this channel

PinsFetchParams

Bases: TypedDict

Params when fetching pinned messages.

before: str instance-attribute

Get pinned messages before this ISO8601 timestamp.

limit: int instance-attribute

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


MessagesFetchParams

Bases: TypedDict

Params when fetching guild channel messages.

limit: int instance-attribute

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

before: int instance-attribute

Get messages before this message ID.

after: int instance-attribute

Get messages after this message ID.

around: int instance-attribute

Get messages around this message ID.


ThreadFromMessageParams

Bases: TypedDict

Params when attaching a thread to a message.

rate_limit_per_user: int instance-attribute

time (seconds) user waits before sending another message.