glados.bot module

class glados.bot.BotImporter(bots_dir: str)[source]

Bases: object

import_bots()[source]

Import all bots in the bots config folder

class glados.bot.GladosBot(token: Union[str, Dict[str, str]], name, signing_secret: Union[str, Dict[str, str]] = None, **kwargs)[source]

Bases: object

GLaDOS Bot represents all the required data and functions for a Slack bot.

Notes

All Slack Web API functions can be called from MyBot.client.*

Parameters
  • name (str) – The name of the bot (URL Safe)

  • token (str, Dict[str, str]) – The bot token

  • signing_secret (str, Dict[str, str]) – The bot signing secret.

name

The name of the bot (URL Safe)

Type

str

token

The bot token

Type

str

client

A Slack client generated for that bot

Type

WebClient

signing_secret

The bots signing secret.

Type

str

check_for_env_vars(value)[source]

Check an input value to see if it is an env_var or enc_env_var and get the value.

Parameters

value (input to check.) –

Returns

Returns the value of the var from either the passed in value, or the env var value.

Return type

Any

delete_message(channel: str, ts: str) → slack.web.slack_response.SlackResponse[source]

Deletes a message that was sent by a bot

Parameters
  • channel

  • ts

send_message(channel: str, message: slack.web.classes.messages.Message) → slack.web.slack_response.SlackResponse[source]

Send a message as the bot

Parameters
  • channel (str) – channel to send the message to

  • message (Message) – message object to send

update_message(channel: str, ts: str, message: slack.web.classes.messages.Message) → slack.web.slack_response.SlackResponse[source]

Updates a message that was sent by the bot

Parameters
  • channel

  • ts

  • message

validate_slack_signature(request: glados.request.GladosRequest)[source]