Skip to content

Channel Events

Note

The following classes come from the scurrypy.events.channel_events module.


GuildChannelCreateEvent dataclass

Bases: Event, ChannelModel

Received when a guild channel has been created.

id: int instance-attribute

ID of the channel.

type: int instance-attribute

Type of channel.

guild_id: Optional[int] instance-attribute

Guild ID of the channel.

parent_id: Optional[int] instance-attribute

Category ID of the channel.

position: Optional[int] instance-attribute

Position of the channel.

name: str instance-attribute

Dispatch name of event.

topic: Optional[str] instance-attribute

Topic of the channel.

nsfw: Optional[bool] instance-attribute

If the channel is flagged NSFW.

last_message_id: Optional[int] instance-attribute

ID of the last message sent in the channel.

last_pin_timestamp: Optional[str] instance-attribute

ISO8601 timestamp of the last pinned messsage in the channel.

rate_limit_per_user: Optional[int] instance-attribute

Seconds user must wait between sending messages in the channel.

permissions: Optional[int] instance-attribute

Permissions for the invoking user in this channel. Includes role and overwrite calculations. [INT_LIMIT]

raw: dict instance-attribute

Event's raw JSON payload. NOT A DATACLASS.

to_dict

Recursively turns the dataclass into a dictionary and drops empty fields.

Returns:

  • dict

    serialized dataclasss

user_can

Checks permissions to see if permission bit is toggled.

Warning

If permission field is None, this function always returns False.

Parameters:

  • permission_bit (int) –

    permission bit. See Permissions.

Returns:

  • bool

    whether the user has this permission


GuildChannelUpdateEvent dataclass

Bases: Event, ChannelModel

Received when a guild channel has been updated.

id: int instance-attribute

ID of the channel.

type: int instance-attribute

Type of channel.

guild_id: Optional[int] instance-attribute

Guild ID of the channel.

parent_id: Optional[int] instance-attribute

Category ID of the channel.

position: Optional[int] instance-attribute

Position of the channel.

name: str instance-attribute

Dispatch name of event.

topic: Optional[str] instance-attribute

Topic of the channel.

nsfw: Optional[bool] instance-attribute

If the channel is flagged NSFW.

last_message_id: Optional[int] instance-attribute

ID of the last message sent in the channel.

last_pin_timestamp: Optional[str] instance-attribute

ISO8601 timestamp of the last pinned messsage in the channel.

rate_limit_per_user: Optional[int] instance-attribute

Seconds user must wait between sending messages in the channel.

permissions: Optional[int] instance-attribute

Permissions for the invoking user in this channel. Includes role and overwrite calculations. [INT_LIMIT]

raw: dict instance-attribute

Event's raw JSON payload. NOT A DATACLASS.

to_dict

Recursively turns the dataclass into a dictionary and drops empty fields.

Returns:

  • dict

    serialized dataclasss

user_can

Checks permissions to see if permission bit is toggled.

Warning

If permission field is None, this function always returns False.

Parameters:

  • permission_bit (int) –

    permission bit. See Permissions.

Returns:

  • bool

    whether the user has this permission


GuildChannelDeleteEvent dataclass

Bases: Event, ChannelModel

Received when a guild channel has been deleted.

id: int instance-attribute

ID of the channel.

type: int instance-attribute

Type of channel.

guild_id: Optional[int] instance-attribute

Guild ID of the channel.

parent_id: Optional[int] instance-attribute

Category ID of the channel.

position: Optional[int] instance-attribute

Position of the channel.

name: str instance-attribute

Dispatch name of event.

topic: Optional[str] instance-attribute

Topic of the channel.

nsfw: Optional[bool] instance-attribute

If the channel is flagged NSFW.

last_message_id: Optional[int] instance-attribute

ID of the last message sent in the channel.

last_pin_timestamp: Optional[str] instance-attribute

ISO8601 timestamp of the last pinned messsage in the channel.

rate_limit_per_user: Optional[int] instance-attribute

Seconds user must wait between sending messages in the channel.

permissions: Optional[int] instance-attribute

Permissions for the invoking user in this channel. Includes role and overwrite calculations. [INT_LIMIT]

raw: dict instance-attribute

Event's raw JSON payload. NOT A DATACLASS.

to_dict

Recursively turns the dataclass into a dictionary and drops empty fields.

Returns:

  • dict

    serialized dataclasss

user_can

Checks permissions to see if permission bit is toggled.

Warning

If permission field is None, this function always returns False.

Parameters:

  • permission_bit (int) –

    permission bit. See Permissions.

Returns:

  • bool

    whether the user has this permission


ChannelPinsUpdateEvent dataclass

Bases: Event, DataModel

Pin update event.

channel_id: int instance-attribute

ID of channel where the pins were updated.

guild_id: Optional[int] instance-attribute

ID of the guild where the pins were updated.

last_pin_timestamp: Optional[str] instance-attribute

ISO8601 formatted timestamp of the last pinned message in the channel.

name: str instance-attribute

Dispatch name of event.

raw: dict instance-attribute

Event's raw JSON payload. NOT A DATACLASS.

to_dict

Recursively turns the dataclass into a dictionary and drops empty fields.

Returns:

  • dict

    serialized dataclasss