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.
Parameters:
-
**kwargs(Unpack[MessagesFetchParams], default:{}) –message fetch params
Note
if no kwargs are provided, default to 50 fetched messages limit.
Returns:
-
list[MessageModel]–queried messages
send
async
¶
Send a message to this channel.
Parameters:
-
message(str | MessagePart) –can be just text or the MessagePart for dynamic messages
Returns:
-
MessageModel–The created Message object
edit
async
¶
Edit this channel's settings.
Parameters:
-
channel(GuildChannel) –channel changes
Returns:
-
ChannelModel–The updated channel object
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:
-
ChannelModel–The updated channel object
fetch_pins
async
¶
Get this channel's 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.
PinsFetchParams
¶
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.