-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not working #3
Comments
hello, my fork is just a test and doesn't work :( I'll try totake a look today |
Thank you. I've got a personal script that works great using matrix-nio that I use with other apps but it seems like builtbot plugins try to avoid external dependencies. |
Could you share a snippet of this? I am trying to make a custom reporter for Matrix using matrix-nio, but the mix of async and twisted defer has defeated me. |
Stand-alone working snippet: import asyncio
from nio import AsyncClient, MatrixRoom, RoomMessageText
async def matrix_post(msg_text):
client = AsyncClient(matrix_server, matrix_user)
await client.login(matrix_pass)
await client.room_send(room_id=room_id, message_type="m.room.message",
content={"msgtype":"m.text", "body":msg_text}) Failing attempt at a custom reporter: from twisted.internet import defer
from buildbot.reporters.base import ReporterBase
from buildbot.reporters.generators.build import BuildStatusGenerator
from buildbot.reporters.message import MessageFormatterFunction
class MatrixReporter(ReporterBase):
name = "MatrixReporter"
secrets = []
def checkConfig(self, serverUrl, auth=None, headers=None,
debug=None, verify=None, generators=None, **kwargs):
if generators is None:
generators = self._create_default_generators()
super().checkConfig(generators=generators, **kwargs)
@defer.inlineCallbacks
def reconfigService(self, serverUrl, auth=None, headers=None,
debug=None, verify=None, generators=None,
**kwargs):
self.debug = debug
self.verify = verify
if generators is None:
generators = self._create_default_generators()
yield super().reconfigService(generators=generators, **kwargs)
self._client = AsyncClient(serverUrl, matrix_user)
def _create_default_generators(self):
formatter = MessageFormatterFunction(lambda context: context['build'], 'plain')
return [
BuildStatusGenerator(message_formatter=formatter, report_new=True)
]
@defer.inlineCallbacks
def sendMessage(self, reports):
msg_text = reports[0]['body']
self._client.login(matrix_pass)
yield self._client.room_send(room_id=room_id, message_type="m.room.message",
content={"msgtype":"m.text", "body":msg_text}) |
I've installed a version build with patches from TurBoss's fork, and I no longer get any errors, but it also just doesn't work. Running on Fedora 36
Python version: 3.10.6
Buildbot version: 3.5.0
Twisted version: 22.4.0
The text was updated successfully, but these errors were encountered: