Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Sijis Aviles
@sijis
@alpinweis there is an alias plugin that should do that already.
I've also created a stub method in the past too.
alpinweis
@alpinweis
@sijis what do you mean by a stub method? do you have examples?
alpinweis
@alpinweis
also, when using the Alias plugin, what's the right way to add aliases during startup? I assume it's probably via running a specific errbot cli in my Dockerfile?
Sijis Aviles
@sijis
For stub method, basically I just created a new method that called the existing one (hard to type on phone, but something like)..

def myoldcmd(..): pass
def newcmd(...): self.myoldcmd(...)
I haven't used that plugin ina while, but if I recall it's stored in the backend (by default a $pluginname.db file). So upon startup the plugin is loaded and the commands should be available
Sijis Aviles
@sijis
If in docker/kube, you may want to use an external backend so that info is stored in a db and not local files
alpinweis
@alpinweis

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.

Sijis Aviles
@sijis
Ya. My cases were much simpler.
sijis
@sijis:matrix.org
[m]
Testing, under Matrix
Joseph Walton-Rivers
@webpigeon:fossgalaxy.com
[m]
Hi from matrix o/
sijis
@sijis:matrix.org
[m]
Joseph Walton-Rivers
@webpigeon:fossgalaxy.com
[m]
https://git.fossgalaxy.com/irc/errbot/backend-matrix is a matrix backend if you need it, mostly works :)
sijis
@sijis:matrix.org
[m]
Thanks. I'm trying to simplify my phone messaging apps
sijis
@sijis:matrix.org
[m]
Joseph Walton-Rivers: that's cool. I'm glad to see teams still using errbot :)
sijis
@sijis:matrix.org
[m]
I just released errbot version 6.1.9!
Versions are on pypi.org and dockerhub.
Carlos
@nzlosh
:clap: :thumbsup:
sijis
@sijis:matrix.org
[m]
Next release, is to focus on slack. Removing what's there and including the v3 version. :)
fernand0
@fernand0_twitter
Thansk for the new release!
I'm not sure about how to report this but in page: https://pypi.org/project/errbot/6.1.9/ the link in 'supports markdown extras formatting' (https://pythonhosted.org/Markdown/extensions/extra.html) seems to be not woking.
fernand0
@fernand0_twitter
fernand0
@fernand0_twitter
I've found it in the README of the project, I've suggested a change via PR.
sijis
@sijis:matrix.org
[m]
Pypi previously supported the syntax in the readme. That's new then. Thanks. I'll take a look at it
Carlos
@nzlosh

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).

sijis
@sijis:matrix.org
[m]
I'm keeping it out of the main repo. My intent is to include in docker file and update documentarion
sijis
@sijis:matrix.org
[m]
And remove the existing slack that are already in the repo
I should had been more clear on that statement.
I do believe having the backends out of the core is a good thing long term, especially if it's heavy iteration one (like slack is)
Carlos
@nzlosh
Oh great! Sorry for the misunderstanding. Good to see the official docker image getting updated. Last time I checked, there were a few unofficial images and rroemhild's defacto image hadn't been updated to the latest errbot release.
Carlos
@nzlosh
I just did a clean installation of errbot 6.1.9 in a virtualenv using Python3.7 and got this error when running 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'
Carlos
@nzlosh
The module 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.
Carlos
@nzlosh
@sijis:matrix.org Do you build and upload the wheel manually to pypi? I can't seem to find any reference to it in github actions. From what I've read, one way to address this issue would be to build two versions of the wheel, one that is tagged with 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.
2 replies
Nyior Clement Jr.
@Nyior

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?

Carlos
@nzlosh
Take another look at the webhook documentation, it doesn't work like you're expecting https://errbot.readthedocs.io/en/latest/user_guide/plugin_development/webhooks.html. There is an example in the documentation how to send messages to the backend when the webhook is called.
Nyior Clement Jr.
@Nyior
@nzlosh Thank you :) I figured out I had to use 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']),
            )
Carlos
@nzlosh
:thumbsup: Good stuff and thanks for sharing.
sijis
@sijis:matrix.org
[m]
Ya, it shouldn't. I think the package will include the version of python
sijis
@sijis:matrix.org
[m]
@nzlosh: I've uploaded a specific py37 wheel. https://pypi.org/project/errbot/6.1.9/#files.
Carlos
@nzlosh
Thanks so much for sorting that out @sijis:matrix.org I'll test it shortly
Carlos
@nzlosh

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)
Carlos
@nzlosh
Installation under python3.9 doesn't have a wheel for dulwich, so installing errbot requires a compiler and python headers to be present on the machine. I don't know if we consider this an errbot issue.
      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.
Installation under py310 works perfectly.
sijis
@sijis:matrix.org
[m]
Seems like I have to do one for each py version. Not a problem
Carlos
@nzlosh
Yeah, it seems to be one of the biggest pain points when supporting multiple Python versions.
sijis
@sijis:matrix.org
[m]
uploaded a py38 version.
the issue is mainly because of the version dependency of https://github.com/errbotio/errbot/blob/master/setup.py#L45-L46
1 reply