from datetime import datetime import asyncio import rollbot class MyBot(rollbot.Rollbot[str]): def read_config(self, key): return key def parse(self, raw): return rollbot.Message( origin_id="REPL", channel_id=".", sender_id=".", timestamp=datetime.now(), origin_admin=True, channel_admin=True, text=raw, attachments=[], ) async def respond(self, res): print(res, flush=True) async def goodbye_command(context): await context.respond(rollbot.Response.from_message(context.message, "Goodbye!")) config = rollbot.CommandConfiguration( bangs=("/",), commands={ "goodbye": goodbye_command, }, call_and_response={ "hello": "Hello!", }, aliases={ "hi": "hello", "bye": "goodbye", } ) bot = MyBot(config, "/tmp/my.db") async def run(): while True: await bot.on_message(input("> ")) asyncio.run(run())