Initial commit
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
Reference in New Issue
Block a user