Skip to content

Commit cc9b512

Browse files
committed
Add command error handling.
1 parent 958eeb7 commit cc9b512

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

nameless/nameless.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import re
44
from datetime import datetime, timezone
55
from pathlib import Path
6-
from typing import override
6+
from typing import Self, override
77

88
import discord
99
from discord import ActivityType, Permissions
@@ -63,6 +63,16 @@ async def on_ready(self):
6363
logging.info("nameless* is now operational!")
6464
nameless_config["nameless"]["start_time"] = datetime.now(timezone.utc)
6565

66+
@override
67+
async def on_command_error(
68+
self, ctx: commands.Context[Self], ex: commands.errors.CommandError
69+
):
70+
await ctx.send(
71+
"Something went wrong during command execution, "
72+
+ "please notify us on GitHub issue if needed."
73+
)
74+
logging.error("Something went wrong.", exc_info=ex)
75+
6676
def start_bot(self, *, is_debug: bool = False):
6777
"""Start the bot."""
6878
logging.info(

0 commit comments

Comments
 (0)