mirror of
https://gitlab.com/octospacc/WinDog.git
synced 2025-06-05 22:09:20 +02:00
Start Matrix support, more refactoring, cleaner /help and /translate
This commit is contained in:
34
LibWinDog/Platforms/Matrix/Matrix.py
Normal file
34
LibWinDog/Platforms/Matrix/Matrix.py
Normal file
@ -0,0 +1,34 @@
|
||||
# ================================== #
|
||||
# WinDog multi-purpose chatbot #
|
||||
# Licensed under AGPLv3 by OctoSpacc #
|
||||
# ================================== #
|
||||
|
||||
MatrixUrl, MatrixUsername, MatrixPassword = None, None, None
|
||||
|
||||
import nio
|
||||
import simplematrixbotlib as MatrixBotLib
|
||||
from threading import Thread
|
||||
|
||||
def MatrixMain() -> bool:
|
||||
if not (MatrixUrl and MatrixUsername and MatrixPassword):
|
||||
return False
|
||||
MatrixBot = MatrixBotLib.Bot(MatrixBotLib.Creds(MatrixUrl, MatrixUsername, MatrixPassword))
|
||||
@MatrixBot.listener.on_message_event
|
||||
@MatrixBot.listener.on_custom_event(nio.events.room_events.RoomMessageFile)
|
||||
async def MatrixMessageListener(room, message) -> None:
|
||||
pass
|
||||
#print(message)
|
||||
#match = MatrixBotLib.MessageMatch(room, message, MatrixBot)
|
||||
#OnMessageReceived()
|
||||
#if match.is_not_from_this_bot() and match.command("windogtest"):
|
||||
# pass #await MatrixBot.api.send_text_message(room.room_id, " ".join(arg for arg in match.args()))
|
||||
def runMatrixBot() -> None:
|
||||
MatrixBot.run()
|
||||
Thread(target=runMatrixBot).start()
|
||||
return True
|
||||
|
||||
def MatrixSender() -> None:
|
||||
pass
|
||||
|
||||
#RegisterPlatform(name="Matrix", main=MatrixMain, sender=MatrixSender)
|
||||
|
Reference in New Issue
Block a user