Skip to content

Ping Bot

The simplest possible bot — one command that replies to !ping with Pong!. Start here if you're new to matrix.py.

from matrix import Bot, Context

bot = Bot()


@bot.command("ping")
async def ping(ctx: Context) -> None:
    await ctx.reply("Pong!")


bot.start(config="config.yaml")

ctx.reply() sends a message back to the same room the command was received in. Swap "Pong!" for any string, including formatted text.