If you have a coding question, you can use stackoverflow with the tag 'errbot' and 'python'
sijis on master
Update README.md with new URL (… (compare)
def myoldcmd(..): pass
def newcmd(...): self.myoldcmd(...)
In my case the long command name has to accept args/options, so the short alias (or the stub method) needs to be declared so that it can accept those options too.
e.g. this is how I imagine I'd define a stub:
@arg_botcmd("-u", "--user", type=str, help=user name")
@arg_botcmd("-p", "--project", type=str, help="project name")
def pagerduty_status(self, msg, project=None, user=None):
......
@arg_botcmd("-u", "--user", type=str, help=user name")
@arg_botcmd("-p", "--project", type=str, help="project name")
def pd_status(self, msg, project=None, user=None):
self._bot._execute_and_send(cmd="pagerduty_status", args=...)
which looks like a lot of duplication.
From a quick view at the Alias plugin I'm not sure the !alias
command supports flags with arbitrary values.
I tried something like
pd_status = pagerduty_status
but that did not seem to work.
I'm in favour of keeping slackv3 outside of the errbot core repo so the backend developers can remain autonomous and apply fixes/features on different release cycles to the core.
If we must merge slackv3 for other reasons, I'd like to see the other backends merge into the core also for consistency sake, at least mattermost and discord (gitter perhaps).
A couple of other backends that'd be good to have in the errbot.io organisation would be MSTeam, Matrix and Keybase (I'm not sure if such a backend would fit with Errbot's architecture).
errbot -h
. Has anyone else seen this?(errbot) root@u1804:/opt/errbot# errbot -h
Traceback (most recent call last):
File "/opt/errbot/bin/errbot", line 5, in <module>
from errbot.cli import main
File "/opt/errbot/lib/python3.7/site-packages/errbot/cli.py", line 27, in <module>
from errbot.bootstrap import CORE_BACKENDS
File "/opt/errbot/lib/python3.7/site-packages/errbot/bootstrap.py", line 10, in <module>
from errbot.plugin_manager import BotPluginManager
File "/opt/errbot/lib/python3.7/site-packages/errbot/plugin_manager.py", line 8, in <module>
from graphlib import CycleError
ModuleNotFoundError: No module named 'graphlib'
graphlib-backport==1.0.3
was missing from the virtualenv. I'm not sure how pip handles dependency resolution when processing wheels, but my current guess is the errbot wheel was built on a version > 3.9 so graphlib-backport
wasn't included. I'll need to dig into how all this works under the hood.
py37.py38
built using py3.7 or py3.8 and another tagged with py39.py310
built using py3.9 or py3.10. I'm not sure if the original wheel tagged with py3
would need to be taken down or if pip will select the most specific version first.
I'm stuck trying to post the payload
received by a webhook function to a Mattermost channel. This is what my webhook function looks like:
@webhook
def github_issues(self, payload):
self.log.debug(repr(payload))
return(payload)
Expected Outcome: I expect that return(payload)
should forward the received payload
to the Mattermost channels I've added my bot to. My bot account currently sits in two Mattermost channels
How it's Working Out: The payload is reaching the function, but it's not being forwarded to the channels I've added the bot to.
Is there anything I need to fix in the function or anywhere to make this arrangement work?
send()
to push data to the backend. This is my updated function just in case someone else needs it: @webhook
def github_issues(self, payload):
for room in self.rooms():
self.send(
self.build_identifier(f"~{room.name}"),
'Title: Issue {0}!\n Issue URL: {1}'.format(payload['action'], payload['issue']['url']),
)
Just tested a clean install of errbot 6.1.9 using a py37 virtualenv and it works as expected. Tested under py38, it fails.
errbot -h
Traceback (most recent call last):
File "/root/virtualenv/errbot_py38/bin/errbot", line 5, in <module>
from errbot.cli import main
File "/root/virtualenv/errbot_py38/lib/python3.8/site-packages/errbot/cli.py", line 27, in <module>
from errbot.bootstrap import CORE_BACKENDS
File "/root/virtualenv/errbot_py38/lib/python3.8/site-packages/errbot/bootstrap.py", line 10, in <module>
from errbot.plugin_manager import BotPluginManager
File "/root/virtualenv/errbot_py38/lib/python3.8/site-packages/errbot/plugin_manager.py", line 8, in <module>
from graphlib import CycleError
ModuleNotFoundError: No module named 'graphlib'
pip pulled in the py3 wheel.
(errbot_py38) root@u2004:~# pip install errbot
Collecting errbot
Downloading errbot-6.1.9-py3-none-any.whl (198 kB)
dulwich/_objects.c:22:10: fatal error: Python.h: No such file or directory
22 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> dulwich
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Yes, as part of your build process you can clone the repo and put it in the plugins directory.
You could also setup the server to use a private key/token that accesses your repo too