2025-01-31 18:12:38 -06:00
|
|
|
import simplematrixbotlib as botLibrary
|
2025-01-31 18:20:14 -06:00
|
|
|
import json
|
2025-01-31 18:12:38 -06:00
|
|
|
|
2025-01-31 18:20:14 -06:00
|
|
|
with open('config.json', 'r') as f:
|
|
|
|
config = json.load(f)
|
|
|
|
|
2025-01-31 18:22:20 -06:00
|
|
|
credentials = botLibrary.Creds(config['configuration']['server'], config['configuration']['userid'], config['configuration']['password'])
|
2025-01-31 18:20:14 -06:00
|
|
|
print(credentials)
|
2025-01-31 18:12:38 -06:00
|
|
|
bot = botLibrary.Bot(credentials)
|
|
|
|
PREFIX = "!q"
|
|
|
|
|
|
|
|
@bot.listener.on_message_event
|
|
|
|
async def help_message(room, message):
|
|
|
|
match = botlib.MessageMatch(room, message, bot, PREFIX)
|
|
|
|
if not (match.is_not_from_this_bot() and match.prefix()
|
|
|
|
and match.command("help")):
|
|
|
|
return
|
|
|
|
|
|
|
|
message = (f"""
|
|
|
|
Help
|
|
|
|
============================
|
|
|
|
A work-in-progress Python rewrite of the original quotes bot, aiming for a mostly complete remake.
|
|
|
|
{PREFIX}help - show this message
|
|
|
|
""")
|
|
|
|
|
|
|
|
await bot.api.send_text_message(room.room_id, message)
|
2025-01-31 18:18:21 -06:00
|
|
|
|
|
|
|
@bot.listener.on_message_event
|
|
|
|
async def make_choice(room, message):
|
|
|
|
match = botlib.MessageMatch(room, message, bot, PREFIX)
|
|
|
|
if not (match.is_not_from_this_bot() and match.prefix()
|
|
|
|
and match.command("get")):
|
|
|
|
return
|
|
|
|
temp = True
|
|
|
|
if not match.args():
|
|
|
|
temp = False
|
|
|
|
else:
|
|
|
|
id = match.args()
|
|
|
|
message = (f"""
|
|
|
|
Command recived (DEBUG_)
|
|
|
|
""")
|
|
|
|
|
|
|
|
await bot.api.send_text_message(room.room_id, message)
|