slackminion.plugin package¶
Submodules¶
slackminion.plugin.base module¶
-
class
slackminion.plugin.base.BasePlugin(bot: Bot, **kwargs)[source]¶ Bases:
object-
get_channel(channel)[source]¶ Utility function to query slack for a particular channel
Parameters: channel – The channel name or id of the channel to lookup Returns: SlackChannel object or None
-
get_channel_by_name(channel_name)[source]¶ Utility function to query slack for a particular channel
Parameters: channel – The channel name of the channel to lookup Returns: SlackChannel object or None
-
get_user(user_id)[source]¶ Utility function to query slack for a particular user
Parameters: user_id – The username of the user to lookup Returns: SlackUser object or None
-
notify_event_types= []¶
-
on_load()[source]¶ Executes when a plugin is loaded.
Override this if your plugin needs to do initialization when loading. Do not use this to restore runtime changes to variables – they will be overwritten later on by PluginManager.load_state()
-
on_unload()[source]¶ Executes when a plugin is unloaded.
Override this if your plugin needs to do cleanup when unloading.
-
send_message(channel, text, thread=None, reply_broadcast=False, parse=None)[source]¶ Used to send a message to the specified channel.
- channel - can be a channel or user
- text - message to send
- thread - thread to reply in
- reply_broadcast - whether or not to also send the message to the channel
- parse - Set to “full” for the slack api to linkify names and channels
-
start_periodic_task(duration, func, *args, **kwargs)[source]¶ Schedules a function to be called after some period of time.
- duration - time in seconds to wait before firing
- func - function to be called
- args - arguments to pass to the function
-
slackminion.plugin.manager module¶
Module contents¶
-
slackminion.plugin.cmd(admin_only=False, acl='*', aliases=None, while_ignored=False, reply_in_thread=False, reply_broadcast=False, parse=None, strip_formatting=False, *args, **kwargs)[source]¶ Decorator to mark plugin functions as commands in the form of !<cmd_name>
- admin_only - indicates only users in bot_admin are allowed to execute (only used if AuthManager is loaded)
- acl - indicates which ACL to perform permission checks against (only used if AuthManager is loaded)
- aliases - register function with additional commands (i.e. !alias1, !alias2, etc)
- while_ignored - allows a command to be run, even if channel has been !sleep
- reply_in_thread - determines whether bot replies in the channel or a thread
- reply_broadcast - if replying in a thread, whether to also send the message to the channel
- parse - Set to “full” for the slack api to linkify names and channels
- strip_formatting - Remove formtting added by slack to the messages