From d2d24175ccb118ca1531450768b824942e3412f5 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 10 Dec 2025 20:33:56 -0800 Subject: [PATCH 01/14] removed empty test file --- tests/test_help.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tests/test_help.py diff --git a/tests/test_help.py b/tests/test_help.py deleted file mode 100644 index e69de29..0000000 From f0a5524291d76540a6c916c7d2b98b8eab549a32 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 10 Dec 2025 20:35:21 -0800 Subject: [PATCH 02/14] refactor examples on shutdown - separate simple shutdown command with error handling --- examples/cooldown.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/examples/cooldown.py b/examples/cooldown.py index a04638a..634e824 100644 --- a/examples/cooldown.py +++ b/examples/cooldown.py @@ -1,7 +1,6 @@ from matrix import Bot, Context, cooldown -from matrix.errors import CooldownError -bot = Bot("examples/config.yaml") +bot = Bot(config="examples/config.yaml") @bot.command(cooldown=(2, 15)) @@ -9,23 +8,11 @@ async def cooldown_command(ctx): await ctx.reply("This is limited to 2 uses per 15s per user.") -@cooldown_command.error(CooldownError) -async def cooldown_error(ctx, error): - print(f"CooldownError invoked: Try again in {error.retry:.1f} seconds.") - await ctx.reply(f"⏳ Try again in {error.retry:.1f}s") - - -@cooldown(2, 10) -@bot.command("hi") -async def hello(ctx: Context): +@cooldown(rate=2, period=10) +@bot.command("hello") +async def hello_world(ctx: Context): print(f"{ctx.sender} invoked {ctx.body} in room {ctx.room_name}.") await ctx.reply("Hello World.") -@hello.error(CooldownError) -async def hello_error(ctx, error): - print(f"CooldownError invoked: Try again in {error.retry:.1f} seconds.") - await ctx.reply(f"⏳ Try again in {error.retry:.1f}s") - - bot.start() From 370c0985cd7d924128d9935207e295b472d1bbcf Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 10 Dec 2025 20:35:34 -0800 Subject: [PATCH 03/14] added example of error handling of shutdown command --- examples/cooldown_error.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 examples/cooldown_error.py diff --git a/examples/cooldown_error.py b/examples/cooldown_error.py new file mode 100644 index 0000000..5166784 --- /dev/null +++ b/examples/cooldown_error.py @@ -0,0 +1,31 @@ +from matrix import Bot, Context, cooldown +from matrix.errors import CooldownError + +bot = Bot(config="examples/config.yaml") + + +# Invoke by using !hello +@cooldown(rate=2, period=10) +@bot.command("hello") +async def cooldown_error(ctx: Context): + print(f"{ctx.sender} invoked {ctx.body} in room {ctx.room_name}.") + await ctx.reply("Hello World.") + + +@cooldown_error.error(CooldownError) +async def cooldown_error_handler(ctx, error): + print(f"CooldownError invoked: Try again in {error.retry:.1f} seconds.") + await ctx.reply(f"⏳ Try again in {error.retry:.1f}s") + + +# Invoke by using !cooldown_command +@bot.command(cooldown=(1, 10)) +async def cooldown_command(ctx): + await ctx.reply("This is limited to 1 uses per 10s per user.") + +@cooldown_command.error(CooldownError) +async def cooldown_error(ctx, error): + print(f"CooldownError invoked: Try again in {error.retry:.1f} seconds.") + await ctx.reply(f"⏳ Try again in {error.retry:.1f}s") + +bot.start() From 37708b333db064af1b54d86541b8c4b584306525 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 10 Dec 2025 20:49:04 -0800 Subject: [PATCH 04/14] ran black and mypy on examples functionalities --- examples/checks.py | 4 ++-- examples/cooldown.py | 4 ++-- examples/cooldown_error.py | 10 ++++++---- examples/error.py | 16 ++++++++-------- examples/ping.py | 4 ++-- examples/reaction.py | 9 +++++---- examples/scheduler.py | 10 +++++----- 7 files changed, 30 insertions(+), 27 deletions(-) diff --git a/examples/checks.py b/examples/checks.py index 24ab944..93536c4 100644 --- a/examples/checks.py +++ b/examples/checks.py @@ -1,12 +1,12 @@ from matrix import Bot, Context -bot = Bot("examples/config.yaml") +bot = Bot(config="examples/config.yaml") allowed_users = {"@alice:matrix.org", "@bob:matrix.org"} @bot.command("secret") -async def secret_command(ctx: Context): +async def secret_command(ctx: Context) -> None: await ctx.reply("🎉 Welcome to the secret club!") diff --git a/examples/cooldown.py b/examples/cooldown.py index 634e824..9022039 100644 --- a/examples/cooldown.py +++ b/examples/cooldown.py @@ -4,13 +4,13 @@ @bot.command(cooldown=(2, 15)) -async def cooldown_command(ctx): +async def cooldown_command(ctx: Context) -> None: await ctx.reply("This is limited to 2 uses per 15s per user.") @cooldown(rate=2, period=10) @bot.command("hello") -async def hello_world(ctx: Context): +async def hello_world(ctx: Context) -> None: print(f"{ctx.sender} invoked {ctx.body} in room {ctx.room_name}.") await ctx.reply("Hello World.") diff --git a/examples/cooldown_error.py b/examples/cooldown_error.py index 5166784..1a38077 100644 --- a/examples/cooldown_error.py +++ b/examples/cooldown_error.py @@ -7,25 +7,27 @@ # Invoke by using !hello @cooldown(rate=2, period=10) @bot.command("hello") -async def cooldown_error(ctx: Context): +async def cooldown_error(ctx: Context) -> None: print(f"{ctx.sender} invoked {ctx.body} in room {ctx.room_name}.") await ctx.reply("Hello World.") @cooldown_error.error(CooldownError) -async def cooldown_error_handler(ctx, error): +async def cooldown_error_handler(ctx: Context, error: CooldownError) -> None: print(f"CooldownError invoked: Try again in {error.retry:.1f} seconds.") await ctx.reply(f"⏳ Try again in {error.retry:.1f}s") # Invoke by using !cooldown_command @bot.command(cooldown=(1, 10)) -async def cooldown_command(ctx): +async def cooldown_command(ctx: Context) -> None: await ctx.reply("This is limited to 1 uses per 10s per user.") + @cooldown_command.error(CooldownError) -async def cooldown_error(ctx, error): +async def cooldown_function(ctx: Context, error: CooldownError) -> None: print(f"CooldownError invoked: Try again in {error.retry:.1f} seconds.") await ctx.reply(f"⏳ Try again in {error.retry:.1f}s") + bot.start() diff --git a/examples/error.py b/examples/error.py index e358f73..c9f8fc6 100644 --- a/examples/error.py +++ b/examples/error.py @@ -1,36 +1,36 @@ from matrix import Bot, Context from matrix.errors import CommandNotFoundError, MissingArgumentError -bot = Bot("examples/config.yaml") +bot = Bot(config="examples/config.yaml") @bot.error(CommandNotFoundError) -async def global_error(error): +async def global_error(error: CommandNotFoundError) -> None: print(f"Glable error handler {error}.") @bot.command("div") -async def division(ctx: Context, a: int, b: int): +async def division(ctx: Context, a: int, b: int) -> None: c = a / b - await ctx.reply(c) + await ctx.reply(str(c)) @division.error(ZeroDivisionError) -async def div_error(ctx, error): +async def div_error(ctx: Context, error: ZeroDivisionError) -> None: print(f"Operation Not Allowed: {error}") await ctx.reply(f"Operation not allowed: {error}") @division.error(ValueError) -async def val_error(ctx, error): +async def val_error(ctx: Context, error: ValueError) -> None: print(f"ValueError: {error}") await ctx.reply(f"ValueError: {error}") @division.error(MissingArgumentError) -async def command_error(ctx, error): +async def command_error(ctx: Context, error: MissingArgumentError) -> None: print(error) - await ctx.reply(error) + await ctx.reply(str(error)) bot.start() diff --git a/examples/ping.py b/examples/ping.py index a8e7735..b64cfbf 100644 --- a/examples/ping.py +++ b/examples/ping.py @@ -1,10 +1,10 @@ from matrix import Bot, Context -bot = Bot("examples/config.yaml") +bot = Bot(config="examples/config.yaml") @bot.command("ping") -async def ping(ctx: Context): +async def ping(ctx: Context) -> None: print(f"{ctx.sender} invoked {ctx.body} in room {ctx.room_name}.") await ctx.reply("Pong!") diff --git a/examples/reaction.py b/examples/reaction.py index d9c585c..8f7bb5a 100644 --- a/examples/reaction.py +++ b/examples/reaction.py @@ -1,10 +1,11 @@ -from matrix import Bot +from asyncio import Event +from matrix import Bot, Room -bot = Bot("examples/config.yaml") +bot = Bot(config="examples/config.yaml") @bot.event -async def on_message(room, event): +async def on_message(room: Room, event: Event) -> None: """ This function listens for new messages in a room and reacts based on the message content. @@ -22,7 +23,7 @@ async def on_message(room, event): @bot.event -async def on_react(room, event): +async def on_react(room: Room, event: Event) -> None: """ This function listens for new member reaction to messages in a room, and reacts based on the reaction emoji. diff --git a/examples/scheduler.py b/examples/scheduler.py index bcb7266..bbb0e85 100644 --- a/examples/scheduler.py +++ b/examples/scheduler.py @@ -1,6 +1,6 @@ from matrix import Bot, Context -bot = Bot("examples/config.yaml") +bot = Bot(config="examples/config.yaml") room_id = "!your_room_id:matrix.org" # Replace with your room ID @@ -8,25 +8,25 @@ @bot.command("ping") -async def ping(ctx: Context): +async def ping(ctx: Context) -> None: print(f"{ctx.sender} invoked {ctx.body} in room {ctx.room_name}.") await ctx.reply("Pong!") @bot.schedule("* * * * *") -async def scheduled_task(): +async def scheduled_task() -> None: print("This task runs every minute.") await room.send(message="Scheduled ping!") @bot.schedule("0 * * * *") -async def hourly_task(): +async def hourly_task() -> None: print("This task runs every hour.") await room.send(message="This is your hourly update!") @bot.schedule("0 9 * * 1-5") -async def weekday_morning_task(): +async def weekday_morning_task() -> None: print("This task runs every weekday at 9 AM.") await room.send(message="Good morning! Here's your weekday update!") From 2c639d24ba81bc1213fbcfc935247781c3a5a1a1 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 10 Dec 2025 20:52:33 -0800 Subject: [PATCH 05/14] Added room to matrix.py import --- matrix/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/matrix/__init__.py b/matrix/__init__.py index 86d366c..e5a749d 100644 --- a/matrix/__init__.py +++ b/matrix/__init__.py @@ -9,6 +9,7 @@ from .command import Command from .help import HelpCommand from .checks import cooldown +from .room import Room __all__ = [ "Bot", @@ -18,4 +19,5 @@ "Context", "HelpCommand", "cooldown", + "Room", ] From 0891a2a7444915160aa8fb0ebf7443e232ddc17a Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 11 Dec 2025 13:36:08 -0800 Subject: [PATCH 06/14] rename file --- examples/{error.py => error_handling.py} | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) rename examples/{error.py => error_handling.py} (87%) diff --git a/examples/error.py b/examples/error_handling.py similarity index 87% rename from examples/error.py rename to examples/error_handling.py index c9f8fc6..60801b7 100644 --- a/examples/error.py +++ b/examples/error_handling.py @@ -6,13 +6,13 @@ @bot.error(CommandNotFoundError) async def global_error(error: CommandNotFoundError) -> None: - print(f"Glable error handler {error}.") + print(f"Global error handler {error}.") @bot.command("div") async def division(ctx: Context, a: int, b: int) -> None: c = a / b - await ctx.reply(str(c)) + await ctx.reply(f"{a} / {b} = {c}") @division.error(ZeroDivisionError) @@ -29,8 +29,7 @@ async def val_error(ctx: Context, error: ValueError) -> None: @division.error(MissingArgumentError) async def command_error(ctx: Context, error: MissingArgumentError) -> None: - print(error) - await ctx.reply(str(error)) + await ctx.reply(f"{error}") bot.start() From 763d0f8acae437bb7e5157b3801f8bc8214d261b Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 11 Dec 2025 13:37:57 -0800 Subject: [PATCH 07/14] refactor cooldown example and address PR comments --- examples/cooldown.py | 28 +++++++++++++++++++++------- examples/cooldown_error.py | 33 --------------------------------- 2 files changed, 21 insertions(+), 40 deletions(-) delete mode 100644 examples/cooldown_error.py diff --git a/examples/cooldown.py b/examples/cooldown.py index 9022039..14f6335 100644 --- a/examples/cooldown.py +++ b/examples/cooldown.py @@ -1,18 +1,32 @@ from matrix import Bot, Context, cooldown +from matrix.errors import CooldownError bot = Bot(config="examples/config.yaml") -@bot.command(cooldown=(2, 15)) -async def cooldown_command(ctx: Context) -> None: - await ctx.reply("This is limited to 2 uses per 15s per user.") - - +# Invoke by using !hello @cooldown(rate=2, period=10) @bot.command("hello") -async def hello_world(ctx: Context) -> None: - print(f"{ctx.sender} invoked {ctx.body} in room {ctx.room_name}.") +async def hello_command(ctx: Context) -> None: await ctx.reply("Hello World.") +@hello_command.error(CooldownError) +async def hello_command_error_handler(ctx: Context, error: CooldownError) -> None: + print(f"CooldownError invoked: Try again in {error.retry:.1f} seconds.") + await ctx.reply(f"⏳ Try again in {error.retry:.1f}s") + + +# Invoke by using !cooldown_command +@bot.command(cooldown=(1, 10)) +async def cooldown_command(ctx: Context) -> None: + await ctx.reply("This is limited to 1 uses per 10s per user.") + + +@cooldown_command.error(CooldownError) +async def cooldown_function(ctx: Context, error: CooldownError) -> None: + print(f"CooldownError invoked: Try again in {error.retry:.1f} seconds.") + await ctx.reply(f"⏳ Try again in {error.retry:.1f}s") + + bot.start() diff --git a/examples/cooldown_error.py b/examples/cooldown_error.py deleted file mode 100644 index 1a38077..0000000 --- a/examples/cooldown_error.py +++ /dev/null @@ -1,33 +0,0 @@ -from matrix import Bot, Context, cooldown -from matrix.errors import CooldownError - -bot = Bot(config="examples/config.yaml") - - -# Invoke by using !hello -@cooldown(rate=2, period=10) -@bot.command("hello") -async def cooldown_error(ctx: Context) -> None: - print(f"{ctx.sender} invoked {ctx.body} in room {ctx.room_name}.") - await ctx.reply("Hello World.") - - -@cooldown_error.error(CooldownError) -async def cooldown_error_handler(ctx: Context, error: CooldownError) -> None: - print(f"CooldownError invoked: Try again in {error.retry:.1f} seconds.") - await ctx.reply(f"⏳ Try again in {error.retry:.1f}s") - - -# Invoke by using !cooldown_command -@bot.command(cooldown=(1, 10)) -async def cooldown_command(ctx: Context) -> None: - await ctx.reply("This is limited to 1 uses per 10s per user.") - - -@cooldown_command.error(CooldownError) -async def cooldown_function(ctx: Context, error: CooldownError) -> None: - print(f"CooldownError invoked: Try again in {error.retry:.1f} seconds.") - await ctx.reply(f"⏳ Try again in {error.retry:.1f}s") - - -bot.start() From 529d868e588c860683a0b97bac64f7ba44be2552 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 11 Dec 2025 14:58:01 -0800 Subject: [PATCH 08/14] added REAMDE documentation to explain how to run the examples --- examples/README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 examples/README.md diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..1ac1f10 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,27 @@ +## Functionality Examples +This directory contains multiple examples demonstrating how to use different +features of the **[matrix.py]** library. Each example is self-contained and can be +run independently. + +### How to Run the Examples +- You will first need to update the environment variables in the [config.yaml](config.yaml) +file with your Matrix credentials and desired settings. + +- To run any of the examples, navigate to the `examples` directory from your +command line and execute the desired Python file using the command line. +For instance: + +```bash +python3 error_handling.py +``` + +Make sure you have all the necessary dependencies installed and configured +before running the examples as instructed in the root [README file](../README.md). + +### Available Examples +- [error_handling.py](error_handling.py): Demonstrates how to handle errors in commands. +- [cooldown.py](cooldown.py): Shows how to implement cooldowns for commands. +- [ping.py](ping.py): A simple ping command example. +- [reaction.py](reaction.py): Example of handling reactions to messages. +- [checks.py](checks.py): Demonstrates how to use checks for command execution. +- [scheduler.py](scheduler.py): Shows how to schedule tasks. From 8231d5e8ebc3460ca01b181e2dd4e107636fe41f Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 11 Dec 2025 14:59:35 -0800 Subject: [PATCH 09/14] Updated config file path for examples --- examples/checks.py | 2 +- examples/cooldown.py | 2 +- examples/error_handling.py | 2 +- examples/ping.py | 2 +- examples/reaction.py | 2 +- examples/scheduler.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/checks.py b/examples/checks.py index 93536c4..26088ef 100644 --- a/examples/checks.py +++ b/examples/checks.py @@ -1,6 +1,6 @@ from matrix import Bot, Context -bot = Bot(config="examples/config.yaml") +bot = Bot(config="config.yaml") allowed_users = {"@alice:matrix.org", "@bob:matrix.org"} diff --git a/examples/cooldown.py b/examples/cooldown.py index 14f6335..97e9abd 100644 --- a/examples/cooldown.py +++ b/examples/cooldown.py @@ -1,7 +1,7 @@ from matrix import Bot, Context, cooldown from matrix.errors import CooldownError -bot = Bot(config="examples/config.yaml") +bot = Bot(config="config.yaml") # Invoke by using !hello diff --git a/examples/error_handling.py b/examples/error_handling.py index 60801b7..7775e01 100644 --- a/examples/error_handling.py +++ b/examples/error_handling.py @@ -1,7 +1,7 @@ from matrix import Bot, Context from matrix.errors import CommandNotFoundError, MissingArgumentError -bot = Bot(config="examples/config.yaml") +bot = Bot(config="config.yaml") @bot.error(CommandNotFoundError) diff --git a/examples/ping.py b/examples/ping.py index b64cfbf..a5903fd 100644 --- a/examples/ping.py +++ b/examples/ping.py @@ -1,6 +1,6 @@ from matrix import Bot, Context -bot = Bot(config="examples/config.yaml") +bot = Bot(config="config.yaml") @bot.command("ping") diff --git a/examples/reaction.py b/examples/reaction.py index 8f7bb5a..204bcd1 100644 --- a/examples/reaction.py +++ b/examples/reaction.py @@ -1,7 +1,7 @@ from asyncio import Event from matrix import Bot, Room -bot = Bot(config="examples/config.yaml") +bot = Bot(config="config.yaml") @bot.event diff --git a/examples/scheduler.py b/examples/scheduler.py index bbb0e85..f27cdb0 100644 --- a/examples/scheduler.py +++ b/examples/scheduler.py @@ -1,6 +1,6 @@ from matrix import Bot, Context -bot = Bot(config="examples/config.yaml") +bot = Bot(config="config.yaml") room_id = "!your_room_id:matrix.org" # Replace with your room ID From c314cf96de700aacaab3ee43683178f1ddeb2bd0 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 11 Dec 2025 18:14:30 -0800 Subject: [PATCH 10/14] removed dead code --- matrix/errors.py | 1 - 1 file changed, 1 deletion(-) diff --git a/matrix/errors.py b/matrix/errors.py index 4b64377..18f3890 100644 --- a/matrix/errors.py +++ b/matrix/errors.py @@ -3,7 +3,6 @@ if TYPE_CHECKING: from .command import Command # pragma: no cover - from .error import Error # pragam: no cover from .group import Group # pragma: no cover Callback = Callable[..., Coroutine[Any, Any, Any]] From 5223e57d0de3be4d97e594e4d136170648e680da Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 11 Dec 2025 18:17:48 -0800 Subject: [PATCH 11/14] refactor example check to add error handling if user not allowed to run command --- examples/checks.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/checks.py b/examples/checks.py index 26088ef..58bf128 100644 --- a/examples/checks.py +++ b/examples/checks.py @@ -1,11 +1,12 @@ from matrix import Bot, Context +from matrix.errors import CheckError bot = Bot(config="config.yaml") allowed_users = {"@alice:matrix.org", "@bob:matrix.org"} -@bot.command("secret") +@bot.command(name="secret") async def secret_command(ctx: Context) -> None: await ctx.reply("🎉 Welcome to the secret club!") @@ -14,8 +15,12 @@ async def secret_command(ctx: Context) -> None: async def is_allowed_user(ctx: Context) -> bool: if ctx.sender in allowed_users: return True - await ctx.reply("You do not have permission to use this command.") return False +@secret_command.error(CheckError) +async def permission_error_handler(ctx: Context, error: CheckError) -> None: + await ctx.reply(f"Access denied: {error}") + + bot.start() From e4943a97a925a0a254ae709cc6de4f40e9f479a0 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 15 Dec 2025 19:39:46 -0800 Subject: [PATCH 12/14] remove debug print statements from cooldown error handlers --- examples/cooldown.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/cooldown.py b/examples/cooldown.py index 97e9abd..8450840 100644 --- a/examples/cooldown.py +++ b/examples/cooldown.py @@ -13,7 +13,6 @@ async def hello_command(ctx: Context) -> None: @hello_command.error(CooldownError) async def hello_command_error_handler(ctx: Context, error: CooldownError) -> None: - print(f"CooldownError invoked: Try again in {error.retry:.1f} seconds.") await ctx.reply(f"⏳ Try again in {error.retry:.1f}s") @@ -25,7 +24,6 @@ async def cooldown_command(ctx: Context) -> None: @cooldown_command.error(CooldownError) async def cooldown_function(ctx: Context, error: CooldownError) -> None: - print(f"CooldownError invoked: Try again in {error.retry:.1f} seconds.") await ctx.reply(f"⏳ Try again in {error.retry:.1f}s") From ad32b503c9798e213df4b45ac0b5a539ed993732 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 15 Dec 2025 20:03:01 -0800 Subject: [PATCH 13/14] remove debug print statements from error handling and ping examples --- examples/error_handling.py | 2 -- examples/ping.py | 1 - 2 files changed, 3 deletions(-) diff --git a/examples/error_handling.py b/examples/error_handling.py index 7775e01..88b7c25 100644 --- a/examples/error_handling.py +++ b/examples/error_handling.py @@ -17,13 +17,11 @@ async def division(ctx: Context, a: int, b: int) -> None: @division.error(ZeroDivisionError) async def div_error(ctx: Context, error: ZeroDivisionError) -> None: - print(f"Operation Not Allowed: {error}") await ctx.reply(f"Operation not allowed: {error}") @division.error(ValueError) async def val_error(ctx: Context, error: ValueError) -> None: - print(f"ValueError: {error}") await ctx.reply(f"ValueError: {error}") diff --git a/examples/ping.py b/examples/ping.py index a5903fd..58d6f39 100644 --- a/examples/ping.py +++ b/examples/ping.py @@ -5,7 +5,6 @@ @bot.command("ping") async def ping(ctx: Context) -> None: - print(f"{ctx.sender} invoked {ctx.body} in room {ctx.room_name}.") await ctx.reply("Pong!") From 2877c0b2281f57ea65c8bd930c31e6612159b07f Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 15 Dec 2025 20:03:08 -0800 Subject: [PATCH 14/14] remove debug print statements from scheduler example --- examples/scheduler.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/scheduler.py b/examples/scheduler.py index f27cdb0..955535a 100644 --- a/examples/scheduler.py +++ b/examples/scheduler.py @@ -9,25 +9,24 @@ @bot.command("ping") async def ping(ctx: Context) -> None: - print(f"{ctx.sender} invoked {ctx.body} in room {ctx.room_name}.") await ctx.reply("Pong!") @bot.schedule("* * * * *") async def scheduled_task() -> None: - print("This task runs every minute.") + # This task runs every minute. await room.send(message="Scheduled ping!") @bot.schedule("0 * * * *") async def hourly_task() -> None: - print("This task runs every hour.") + # This task runs every hour. await room.send(message="This is your hourly update!") @bot.schedule("0 9 * * 1-5") async def weekday_morning_task() -> None: - print("This task runs every weekday at 9 AM.") + # This task runs every weekday at 9 AM. await room.send(message="Good morning! Here's your weekday update!")