omnibot.services.slack package¶
Submodules¶
omnibot.services.slack.base_message module¶
- class omnibot.services.slack.base_message.BaseMessage(bot: Bot, event: dict, event_trace: dict, omnibot_payload_type: str)¶
Bases:
objectBase class for representing a parsed slack event message.
- property args¶
Used during callback for omnibot receiver route rule matching.
- property bot¶
The bot associated with the app that received this message from the event subscription api. To get info about a bot that may have sent this message, see bot_id.
- property bot_id¶
The bot_id associated with the message, if the message if from a bot. If this message isn’t from a bot, this will return None.
- property channel¶
- property channel_id¶
- property command_text¶
- property event_trace¶
- property match¶
- property match_type¶
- property payload¶
- set_match(match_type: str, match: str)¶
- property team¶
- property ts¶
The timestamp of the event.
- property user¶
omnibot.services.slack.bot module¶
- class omnibot.services.slack.bot.Bot(team, name, data)¶
Bases:
objectClass for representing a slack bot.
- _configure_handlers()¶
- property allowed_bot_messages¶
- property bot_id¶
- classmethod get_bot_by_bot_id(team, bot_id)¶
- classmethod get_bot_by_name(team, name)¶
- classmethod get_bot_by_verification_token(verification_token)¶
- property interactive_component_handlers¶
- property logging_context¶
- property message_handlers¶
- property name¶
- property oauth_bot_token¶
- property oauth_user_token¶
- property slash_command_handlers¶
- property team¶
- property user_id¶
- property verification_token¶
- exception omnibot.services.slack.bot.BotInitializationError¶
Bases:
Exception
omnibot.services.slack.interactive_component module¶
- class omnibot.services.slack.interactive_component.InteractiveComponent(bot, component, event_trace)¶
Bases:
objectClass for representing a parsed slack InteractiveComponent.
- _parse_message()¶
- property action_ts¶
- property actions¶
- property bot¶
The bot associated with the app that received this message from the slash component api. To get info about a bot that may have sent this message, see bot_id.
- property callback_id¶
- property channel¶
- property channel_id¶
- property component_type¶
- property event_trace¶
- property message¶
- property parsed_channel¶
- property parsed_user¶
- property payload¶
- property response_url¶
- property submission¶
- property team¶
- property trigger_id¶
- property user¶
omnibot.services.slack.message module¶
- class omnibot.services.slack.message.Message(bot: Bot, event: dict, event_trace: dict)¶
Bases:
BaseMessageClass for representing a parsed slack message.
- _check_unsupported()¶
- _is_allowed_bot_message()¶
- _parse_payload()¶
- property channels¶
- property directed¶
- property emails¶
- property mentioned¶
- property parent_user_id¶
The user_id of the parent message, if this is a reply to a message.
- property parsed_text¶
- property specials¶
- property subtype¶
- property text¶
- property thread_ts¶
The timestamp of the parent message, if this is a reply to a message. :return:
- property urls¶
- property users¶
- exception omnibot.services.slack.message.MessageUnsupportedError¶
Bases:
Exception
omnibot.services.slack.parser module¶
- omnibot.services.slack.parser.extract_channels(text, bot)¶
- omnibot.services.slack.parser.extract_command(text, bot)¶
- omnibot.services.slack.parser.extract_emails(text)¶
- omnibot.services.slack.parser.extract_emojis(text)¶
- omnibot.services.slack.parser.extract_mentions(text, bot, channel)¶
- omnibot.services.slack.parser.extract_specials(text)¶
- omnibot.services.slack.parser.extract_subteams(text, bot)¶
- omnibot.services.slack.parser.extract_urls(text)¶
- omnibot.services.slack.parser.extract_users(text, bot)¶
- omnibot.services.slack.parser.replace_channels(text, channels)¶
- omnibot.services.slack.parser.replace_emails(text, emails)¶
- omnibot.services.slack.parser.replace_specials(text, specials)¶
- omnibot.services.slack.parser.replace_urls(text, urls)¶
- omnibot.services.slack.parser.replace_users(text, users)¶
- omnibot.services.slack.parser.unextract_channels(text, bot)¶
- omnibot.services.slack.parser.unextract_specials(text)¶
- omnibot.services.slack.parser.unextract_users(text, bot)¶
omnibot.services.slack.reaction module¶
- class omnibot.services.slack.reaction.Reaction(bot: Bot, event: dict, event_trace: dict)¶
Bases:
BaseMessageClass for representing a parsed slack reaction.
- _check_unsupported()¶
- property emoji_name¶
The emoji name of the reaction (e.g. “+1”, “-1”, “smile”, etc.).
- property item_channel¶
The channel the (e.g. “message”, “file”, etc.) that was reacted to was in.
- property item_ts¶
The timestamp of the item (e.g. “message”, “file”, etc.) that was reacted to.
- property item_type¶
The type of the item (e.g. “message”, “file”, etc.) that was reacted to.
- property item_user¶
The user who created the item (e.g. “message”, “file”, etc.) that was reacted to. This is not always present, such as in reaction events to slack command responses.
- exception omnibot.services.slack.reaction.ReactionUnsupportedError¶
Bases:
Exception
omnibot.services.slack.slash_command module¶
- class omnibot.services.slack.slash_command.SlashCommand(bot, command, event_trace)¶
Bases:
objectClass for representing a parsed slack SlashCommand.
- _parse_payload()¶
- property bot¶
The bot associated with the app that received this message from the slash command api. To get info about a bot that may have sent this message, see bot_id.
- property bot_id¶
The bot_id associated with the message, if the message if from a bot. If this message isn’t from a bot, this will return None.
- property channel¶
- property channel_id¶
- property channels¶
- property command¶
- property emails¶
- property enterprise_id¶
- property enterprise_name¶
- property event_trace¶
- property parsed_text¶
- property payload¶
- property response_url¶
- property specials¶
- property team¶
- property text¶
- property trigger_id¶
- property urls¶
- property user_id¶
- property users¶
omnibot.services.slack.team module¶
- class omnibot.services.slack.team.Team(name, team_id)¶
Bases:
objectClass for representing a slack team.
- classmethod get_team_by_id(team_id)¶
- classmethod get_team_by_name(name)¶
- property logging_context¶
- property name¶
- property team_id¶
- exception omnibot.services.slack.team.TeamInitializationError¶
Bases:
Exception
Module contents¶
Slackclient wrapper.
- omnibot.services.slack._get_channel_from_cache(bot, channel)¶
- omnibot.services.slack._get_channel_name_from_cache(key, bot_name, value)¶
- omnibot.services.slack._get_conversations(bot, team)¶
Get all conversations
- omnibot.services.slack._get_emoji(bot)¶
- omnibot.services.slack._get_failure_context(result)¶
Get the logging context from a failed slack call.
- omnibot.services.slack._get_users(bot, team, max_retries=5, sleep=5)¶
- omnibot.services.slack.client(bot, client_type='bot')¶
Global Slack client.
- omnibot.services.slack.get_auth(bot)¶
Get the auth info for the bot.
- omnibot.services.slack.get_bot_info(bot, bot_id: str)¶
Get bot info, from its bot id
- omnibot.services.slack.get_channel(bot, channel)¶
Get a channel, from its channel id
- omnibot.services.slack.get_channel_by_name(bot, channel)¶
Get a channel, from its channel name. This function will only fetch from cache. If the channel isn’t in cache, it will return None.
- omnibot.services.slack.get_channels(bot)¶
- omnibot.services.slack.get_emoji(bot, name)¶
- omnibot.services.slack.get_groups(bot)¶
- omnibot.services.slack.get_im_channel_id(bot, user_id)¶
- omnibot.services.slack.get_ims(bot)¶
- omnibot.services.slack.get_message(bot, channel: str, timestamp: str)¶
Get a message, from its channel and timestamp
- omnibot.services.slack.get_mpims(bot)¶
- omnibot.services.slack.get_name_from_user(user)¶
- omnibot.services.slack.get_user(bot, user_id)¶
Get a user, from its user id
- omnibot.services.slack.get_user_by_email(bot, email)¶
- omnibot.services.slack.get_user_by_name(bot, username)¶
- omnibot.services.slack.get_users(bot)¶
- omnibot.services.slack.update_channel(bot, channel)¶
- omnibot.services.slack.update_conversations(bot, team)¶
- omnibot.services.slack.update_emoji(bot)¶
- omnibot.services.slack.update_group(bot, group)¶
- omnibot.services.slack.update_im(bot, im)¶
- omnibot.services.slack.update_mpim(bot, mpim)¶
- omnibot.services.slack.update_user(bot, user)¶
- omnibot.services.slack.update_users(bot, team)¶