Models

Note

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

Messages

Message

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: Optional[Member]

Message author.

Returns

Message author.

Return type

Optional[Member]

property channel: Channel

Message channel data.

Returns

Message channel.

Return type

Channel

await delete() None

It deletes a message.

property team: Team

Message team. :returns: Message team. :rtype: Team

DeletedMessage

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

JoinMessage

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

property author: Optional[Member]

Message author.

Returns

Message author.

Return type

Optional[Member]

property channel: Channel

Message channel data.

Returns

Message channel.

Return type

Channel

await delete() None

It deletes a message.

property team: Team

Message team. :returns: Message team. :rtype: Team

ArchivedMessage

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

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 archive()

This channel archive.

await send(text: str) Message

This function is a coroutine

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)

This function is a coroutine

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

channel_id

deleted channel id.

Type

str

Teams

Attributes
Methods
class slack.Team

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

id

Team ID.

Type

str

url

team link.

Type

bool

icon

Team icon data.

Type

Icon

name

Team name.

Type

str

await create_channel(name: str, join: bool = True) Channel

Create new channel.

Parameters
  • name (str) – new channel name.

  • join (bool) – is bot join.

Returns

Return created channel.

Return type

Channel

Icon

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

Members

class slack.Member

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

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

bot

Is bot.

Type

bool

property mention: str

Return member mention.

Returns

mention.

Return 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