Initial commit

This commit is contained in:
KKlochko
2023-06-16 16:00:33 +02:00
committed by GitHub
commit 2cc416ac00
10 changed files with 131 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import nio
import simplematrixbotlib as botlib
from .help import help_handler
def setup(bot: botlib.Bot, prefix: str):
@bot.listener.on_message_event
async def help_command(room: nio.rooms.MatrixRoom, message: nio.events.room_events.Event):
match = botlib.MessageMatch(room, message, bot, prefix=prefix)
if match.is_not_from_this_bot() and match.prefix() and match.command('help'):
await help_handler(bot=bot, room_id=room.room_id, sender=message.sender, admin_id=bot.config.admin_id)
+10
View File
@@ -0,0 +1,10 @@
import simplematrixbotlib as botlib
async def help_handler(room_id: str, bot: botlib.Bot, sender: str, admin_id: str):
msg: str = 'Hi **{}**\n\n' \
'Prefix: `!`\n' \
'Its a simplematrixbotlib template!\n' \
'Admin contact: **{}**'
await bot.api.send_markdown_message(room_id=room_id, message=msg.format(sender, admin_id))