From 6d2045bd3905b209f593885fe2e1a5034ad807b4 Mon Sep 17 00:00:00 2001 From: aikaterna <20862007+aikaterna@users.noreply.github.com> Date: Mon, 12 Apr 2021 11:04:13 -0700 Subject: [PATCH] [Quiz] Catch bad category ID --- quiz/quiz.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/quiz/quiz.py b/quiz/quiz.py index 0b3cde4..09a6c74 100644 --- a/quiz/quiz.py +++ b/quiz/quiz.py @@ -108,7 +108,10 @@ class Quiz(commands.Cog): if 9 <= int(category_name_or_id) >= 32: return await ctx.send(f"Invalid category number. Use `{ctx.prefix}quiz categories` to see a list.") category_id = category_name_or_id - category_name = await self.category_name_from_id(int(category_name_or_id)) + try: + category_name = await self.category_name_from_id(int(category_name_or_id)) + except RuntimeError: + return await ctx.send(f"Invalid category ID. Use `{ctx.prefix}quiz categories` to see a list.") else: # cat name specified try: