How can a rung a command from an err-bot plugin from another err-bot plugin?
run the "!dosomething" from another plugin on some type of scheduler.
How can a rung a command from an err-bot plugin from another err-bot plugin?
run the "!dosomething" from another plugin on some type of scheduler.
You can run a command from another plugin by calling the method directly. self.get_plugin(PluginName) after your plugin is activated will get you an instance of the other plugin. You can then call methods from that plugin.
from errbot import BotPlugin, botcmd
class MyPlugin(BotPlugin):
def activate(self):
super().activate() # <-- needs to be *before* get_plugin
self.get_plugin('Duo2fa').add_command('foo_bar')
@botcmd
def foo_bar(self, msg, args):
return "Bar" # will only run if --2fa is passed
This example is from https://github.com/andrewthetechie/errbot-duo2fa
on some type of scheduler.
Errbot offers pollers that let you run code on a schedule. Documentation is here: https://errbot.readthedocs.io/en/latest/user_guide/plugin_development/scheduling.html
You can also use another scheduling library and run it in a separate thread as part of your plugin. Here's an example in another plugin https://github.com/andrewthetechie/err-topic-a-day/blob/main/topic-a-day.py using apscheduler.
You can try asking questions about errbot at gitter: https://gitter.im/errbotio/errbot