Models

Note

Nearly all classes here have slots defined which means that it is impossible to have dynamic attributes to the data classes.

Teams

Attributes
class slack.Team

This function takes in a TeamPayload object and sets the data attribute of the Team object to the TeamPayload object

state

The connection state.

Type

ConnectionState

id

Team ID.

Type

str

url

team link.

Type

bool

icon

Team icon data.

Type

Icon

name

Team name.

Type

str

class slack.Icon

This function is used to initialize the Icon class

team

The team that the icon is for.

Type

Team

image_default
Type

bool

image_34

image url.

Type

str

image_44
Type

str

image_68
Type

str

image_88
Type

str

image_102
Type

str

image_230
Type

str

image_132
Type

str

Channels

Methods
class slack.Channel

This function is a constructor for the Channel class. It takes in a ConnectionState object and a ChannelPayload object. It sets the state, id, name, team, created_at, and created_by attributes of the Channel object. It then calls the overload function

id

Channel ID.

Type

str

team

Your team object.

Type

Team

name

Account name.

Type

str

created_at

When create this channel.

Type

datetime

created_by

Who channel create.

Type

Member

await send(text: str) Message

It sends a message to a channel.

Parameters

text (str) – The text of the message to send.

Returns

A Message object.

Return type

Message

await send_as_user(text: str)
Parameters

text (str) – Message you want to send by your.

Returns

A Message object.

Return type

Message

DeletedChannel

Attributes
class slack.DeletedChannel

This function is called when a channel is deleted

state

ConnectionState

Type

ConnectionState

Messages

Methods
class slack.Message

This function is a constructor for the Message class. It takes in two parameters, state and data. The state parameter is a ConnectionState object, and the data parameter is a MessagePayload object. The function then sets the state, team_id, id, author, channel_id, and created_at attributes of the Message object

id

Message ID.

Type

str

content

Message content.

Type

str

created_at

Message created at.

Type

datetime

property author: Member

returns: Message author. :rtype: Member

property channel: Channel

returns: Message channel. :rtype: Channel

await delete() None

It deletes a message.

property team: Team

returns: Message team. :rtype: Team

class slack.DeletedMessage

This function is used to delete a message from a channel

channel

The deleted Message.

Type

Channel

ts

time when deleted

Type

datetime

hidden

is ephemeral

Type

bool

deleted_text

The text what deleted message.

Type

str

Attributes
Methods
class slack.JoinMessage

This function is a constructor for the JoinMessage class. It takes in a ConnectionState and a JoinMessagePayload as parameters and sets the author of the message to the user in the JoinMessagePayload

state

The ConnectionState object that represents the current state of the connection.

Type

ConnectionState

property author: Member

returns: Message author. :rtype: Member

property channel: Channel

returns: Message channel. :rtype: Channel

await delete() None

It deletes a message.

property team: Team

returns: Message team. :rtype: Team

Attributes
class slack.ArchivedMessage

A constructor for the class.

ts

The data that was sent in the message.

Type

datetime

user

The user who archibed channel

Type

Member

channel

Archived channel.

Type

Channel

Members

Attributes
class slack.Member

This function takes in a UserPayload object and assigns it to the data attribute of the User class

state

The connection state.

Type

ConnectionState

id

Your user ID.

Type

str

team

Your team object.

Type

Team

deleted

Account was deleted.

Type

bool

color

Account icon color.

Type

str

name

Account name.

Type

str

Reaction-Event

class slack.ReactionEventType
type

Reaction type.

Type

str

reaction

Reaction name.

Type

str

file

File ID(optional).

Type

Optional[str]

file_comment

File comment(optional).

Type

Optional[str]

channel

Channel data(optional).

Type

Channel

timestamp

Message created at.

Type

datetime.datetime