slack.slack#
Slacker is a lightweight wrapper used to send messages using SlackClient, Slack’s python API library.
Slack Token#
You will have to create a new Slack App and install it to your workspace. This should generate the OAuth token needed by Bookmarks.
Scopes#
The Slack App requires the users:read and chat:write scopes to function. To send messages to Slack Channels the bot is not part of add chat:write.public. Scopes channels:read and groups:read are needed to list the available Slack channels.
See http://api.slack.com/apps for more information.
Classes:
|
|
|
Customized SlackClient used by bookmarks to send and receive messages. |
|
|
|
Model used to store the available profiles. |
|
- class bookmarks.slack.slack.OverlayWidget(parent=None)[source]#
Bases:
QWidget
Methods:
paintEvent
(self, event)showEvent
(event)Show event handler.
- class bookmarks.slack.slack.SlackClient(token)[source]#
Bases:
WebClient
Customized SlackClient used by bookmarks to send and receive messages.
Methods:
Returns all conversations and groups.
Returns all available profiles in the workspace associated with the token.
send_message
(channel, text)Send a message using SlackClient.
Tests the slack token and the permissions needed to send messages to channels.
- get_user_profiles()[source]#
Returns all available profiles in the workspace associated with the token. Make sure scope users.read is available for the token.
- Raises:
ValueError – If the token is invalid or missing a required scope.
- verify_token()[source]#
Tests the slack token and the permissions needed to send messages to channels.
Using the Conversations API,the app requires any channels:read and/or groups:read to get channel lists.
Addittionally, chat.write and users.read are required to send messages.
- Raises:
ValueError – When the any problems with the token.
- class bookmarks.slack.slack.SlackWidget(token, parent=None)[source]#
Bases:
QDialog
Methods:
Sends a message using the SlackClient API.
showEvent
(event)Show event handler.
- class bookmarks.slack.slack.UsersModel(token, parent=None)[source]#
Bases:
QAbstractItemModel
Model used to store the available profiles.
Methods:
columnCount
(self[, parent])data
(self, index[, role])get_icon
(index)Downloads and sets the icon for the given index.
get_pretty_name
(member)Returns a pretty name for the given member.
index
(row, column[, parent])Bog-standard index creator.
Initializes data.
parent
(-> PySide2.QtCore.QObject)rowCount
(self[, parent])setData
(self, index, value[, role])- columnCount(self, parent: PySide2.QtCore.QModelIndex = Invalid(PySide2.QtCore.QModelIndex)) int [source]#
- data(self, index: PySide2.QtCore.QModelIndex, role: int = PySide2.QtCore.Qt.ItemDataRole.DisplayRole) Any [source]#
- parent(self) PySide2.QtCore.QObject [source]#
- parent(self, child: PySide2.QtCore.QModelIndex) PySide2.QtCore.QModelIndex