Compare commits
2 Commits
4033d214ff
...
4c6ed4c514
| Author | SHA1 | Date | |
|---|---|---|---|
| 4c6ed4c514 | |||
| ec7b330b90 |
11
Changelog
11
Changelog
@@ -1,11 +0,0 @@
|
|||||||
TellMe Server (2.2.0)
|
|
||||||
* Moved the notifier into tellmesrv
|
|
||||||
|
|
||||||
TellMe Server (2.1.0)
|
|
||||||
* Added support for GoAlert messages
|
|
||||||
|
|
||||||
TellMe Server (2.0.0b2)
|
|
||||||
* Add logging
|
|
||||||
|
|
||||||
TellMe Server (2.0.0b1)
|
|
||||||
* First standalone bot with SimpleX support
|
|
||||||
11
client/CHANGELOG.md
Normal file
11
client/CHANGELOG.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## [2.3.0] - 2026-05-04
|
||||||
|
### Added
|
||||||
|
- Client version 2.3.0 release
|
||||||
|
|
||||||
|
### Features
|
||||||
|
- Send messages: `-m "Your message"` - Send custom notifications
|
||||||
|
- Monitor processes: `-p <pid>` - Wait for a process to exit, then notify
|
||||||
|
- Watch commands: `-w "command"` - Run a command periodically and notify on output
|
||||||
|
- Ping hosts: `-P <host>` - Monitor host availability until it's reachable
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "TellMe",
|
"name": "TellMe",
|
||||||
"version": "3.0.0",
|
"version": "2.3.0",
|
||||||
"description": "TellMe CLI",
|
"description": "TellMe CLI",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "webpack-dev-server --inline --hot"
|
"dev": "webpack-dev-server --inline --hot"
|
||||||
|
|||||||
29
server/CHANGELOG.md
Normal file
29
server/CHANGELOG.md
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## [2.3.0] - 2026-05-04
|
||||||
|
### Added
|
||||||
|
- Matrix/Element support via matrix-nio
|
||||||
|
- Auto-join Matrix rooms on invite
|
||||||
|
- Matrix access token instructions in README
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Fixed Code typo in GoAlert verification message
|
||||||
|
|
||||||
|
## [2.2.0] - 2025-02-04
|
||||||
|
### Changed
|
||||||
|
- Moved the notifier into tellmesrv
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Support for GoAlert messages
|
||||||
|
|
||||||
|
## [2.1.0] - 2025-02-04
|
||||||
|
### Added
|
||||||
|
- Added support for GoAlert messages
|
||||||
|
|
||||||
|
## [2.0.0b2] - 2025-02-04
|
||||||
|
### Added
|
||||||
|
- Add logging
|
||||||
|
|
||||||
|
## [2.0.0b1] - 2025-02-04
|
||||||
|
### Added
|
||||||
|
- First standalone bot with SimpleX support
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "TellMe Server",
|
"name": "TellMe Server",
|
||||||
"version": "3.0.0",
|
"version": "2.3.0",
|
||||||
"description": "TellMe Server",
|
"description": "TellMe Server",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "webpack-dev-server --inline --hot"
|
"dev": "webpack-dev-server --inline --hot"
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
matrix_homeserver: ""
|
||||||
|
matrix_access_token": ""
|
||||||
|
matrix_user_id: ""
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
flask
|
flask
|
||||||
websocket-client
|
websocket-client
|
||||||
pyyaml
|
pyyaml
|
||||||
matrix-client
|
matrix-nio
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ import random
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
from matrix_client.client import MatrixClient
|
from nio import AsyncClient, MatrixRoom, RoomMessageText
|
||||||
|
from nio.exceptions import OlmUnverifiedDeviceError
|
||||||
|
import asyncio
|
||||||
|
|
||||||
__version__ = "3.0.0"
|
__version__ = "3.0.0"
|
||||||
versionstring='Taurix TellMe server v' + __version__
|
versionstring='Taurix TellMe server v' + __version__
|
||||||
@@ -71,6 +73,48 @@ def send_smp_message(target, message):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
async def matrix_login_and_send(homeserver, access_token, user_id, target, message):
|
||||||
|
client = AsyncClient(homeserver, user_id)
|
||||||
|
client.access_token = access_token
|
||||||
|
|
||||||
|
invited_rooms = []
|
||||||
|
|
||||||
|
async def auto_join_callback(room: MatrixRoom, event: RoomMessageText, client: AsyncClient):
|
||||||
|
pass
|
||||||
|
|
||||||
|
async def invited_callback(room: MatrixRoom, event: RoomMessageText, client: AsyncClient):
|
||||||
|
invited_rooms.append(room.room_id)
|
||||||
|
|
||||||
|
client.add_event_callback(auto_join_callback, RoomMessageText)
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = await client.sync(full_state=True)
|
||||||
|
for room_id, invite_state in client.invited_rooms.items():
|
||||||
|
await client.join(room_id)
|
||||||
|
invited_rooms.append(room_id)
|
||||||
|
|
||||||
|
if target not in client.rooms and target not in invited_rooms:
|
||||||
|
await client.join(target)
|
||||||
|
|
||||||
|
room = client.rooms.get(target)
|
||||||
|
if room:
|
||||||
|
await client.room_send(
|
||||||
|
room_id=target,
|
||||||
|
message_type="m.room.message",
|
||||||
|
content={"msgtype": "m.text", "body": message}
|
||||||
|
)
|
||||||
|
log.info("Sent message to Matrix room %s" % (target))
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
log.error("Could not join Matrix room %s" % (target))
|
||||||
|
return False
|
||||||
|
except Exception as e:
|
||||||
|
log.error("Failed to send Matrix message: %s" % (e))
|
||||||
|
return False
|
||||||
|
finally:
|
||||||
|
await client.close()
|
||||||
|
|
||||||
|
|
||||||
def send_matrix_message(target, message):
|
def send_matrix_message(target, message):
|
||||||
try:
|
try:
|
||||||
homeserver = config.get('matrix_homeserver', 'https://matrix.org')
|
homeserver = config.get('matrix_homeserver', 'https://matrix.org')
|
||||||
@@ -81,15 +125,9 @@ def send_matrix_message(target, message):
|
|||||||
log.error("Matrix credentials not configured")
|
log.error("Matrix credentials not configured")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
client = MatrixClient(homeserver)
|
return asyncio.get_event_loop().run_until_complete(
|
||||||
client.login(token=access_token, user_id=user_id)
|
matrix_login_and_send(homeserver, access_token, user_id, target, message)
|
||||||
|
)
|
||||||
room = client.join_room(target)
|
|
||||||
room.send_text(message)
|
|
||||||
|
|
||||||
client.logout()
|
|
||||||
log.info("Sent message to Matrix room %s" % (target))
|
|
||||||
return True
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error("Failed to send message to Matrix: %s" % (e))
|
log.error("Failed to send message to Matrix: %s" % (e))
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user