From 8cdeb0a316628f2e581e66e0c72442ac23c56a74 Mon Sep 17 00:00:00 2001 From: Arjun Satarkar Date: Sat, 9 Mar 2024 16:12:09 -0500 Subject: question_of_the_day: use get_member in paginate_questions Repeatedly running `fetch_member` is making this operation take a very long time, scaling with the number of questions present in the list. In practice, roughly 8 seconds was observed for just 22 questions when calling `qotd list`. Switching to `get_member` makes this near-instantaneous. --- question_of_the_day/question_of_the_day.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/question_of_the_day/question_of_the_day.py b/question_of_the_day/question_of_the_day.py index 1a0f74b..a307552 100644 --- a/question_of_the_day/question_of_the_day.py +++ b/question_of_the_day/question_of_the_day.py @@ -418,7 +418,7 @@ class QuestionOfTheDay(commands.Cog): "\n".join( [ f"{i + 1}. {redbot.core.utils.chat_formatting.bold(question['question'])} by " - + (await ctx.guild.fetch_member(question["asked_by"])).name + + (ctx.guild.get_member(question["asked_by"])).name + f" ({question['asked_by']})" for i, question in enumerate(questions) ] -- cgit v1.2.3-57-g22cb