mirror of
https://github.com/moan0s/alertbot.git
synced 2024-06-16 23:32:19 +00:00
Add fix #2
This commit is contained in:
parent
0852881a79
commit
71d27f5176
|
@ -1,3 +1,8 @@
|
|||
# December 2022
|
||||
|
||||
* Handle sending an alert to a room where the bot is not allowed to send messages [#2](https://github.com/moan0s/alertbot/issues/2)
|
||||
* Add [uptime-kuma](https://github.com/louislam/uptime-kuma) resolved message with proper formatting
|
||||
|
||||
# September 2022
|
||||
|
||||
* Add [uptime-kuma](https://github.com/louislam/uptime-kuma) example
|
|
@ -3,6 +3,7 @@ from maubot.handlers import web, command
|
|||
from aiohttp.web import Request, Response, json_response
|
||||
import json
|
||||
import datetime
|
||||
from mautrix.errors.request import MForbidden
|
||||
|
||||
helpstring = f"""# Alertbot
|
||||
|
||||
|
@ -186,7 +187,11 @@ class AlertBot(Plugin):
|
|||
@web.post("/webhook/{room_id}")
|
||||
async def webhook_room(self, req: Request) -> Response:
|
||||
room_id = req.match_info["room_id"].strip()
|
||||
try:
|
||||
await self.send_alert(req, room=room_id)
|
||||
except MForbidden:
|
||||
self.log.error(f"Could not send to {room_id}: Forbidden. Most likely the bot is not invited in the room.")
|
||||
return json_response('{"status": "forbidden", "error": "forbidden"}', status=403)
|
||||
return json_response({"status": "ok"})
|
||||
|
||||
@command.new()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
maubot: 0.1.0
|
||||
id: de.hyteck.alertbot
|
||||
version: 1.1.0
|
||||
version: 1.1.1
|
||||
license: AGPL-3.0-or-later
|
||||
modules:
|
||||
- alertbot
|
||||
|
|
Loading…
Reference in New Issue
Block a user