aboutsummaryrefslogtreecommitdiff
path: root/question_of_the_day
diff options
context:
space:
mode:
authorArjun Satarkar <me@arjunsatarkar.net>2023-12-21 13:31:15 +0000
committerArjun Satarkar <me@arjunsatarkar.net>2023-12-21 13:31:15 +0000
commit970877c52f2722c1cd4ecb47ef1a9edd68f88e88 (patch)
treef8f5fc76eb6320bbe6d58d6b576bfe6c930b59d9 /question_of_the_day
parent58fe7e28b31a37a20fe2dff4463b5184a8340fb3 (diff)
downloadaps-cogs-970877c52f2722c1cd4ecb47ef1a9edd68f88e88.tar
aps-cogs-970877c52f2722c1cd4ecb47ef1a9edd68f88e88.tar.gz
aps-cogs-970877c52f2722c1cd4ecb47ef1a9edd68f88e88.zip
question_of_the_day: improve formatting
Diffstat (limited to 'question_of_the_day')
-rw-r--r--question_of_the_day/question_of_the_day.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/question_of_the_day/question_of_the_day.py b/question_of_the_day/question_of_the_day.py
index e4514ba..bd5f4ea 100644
--- a/question_of_the_day/question_of_the_day.py
+++ b/question_of_the_day/question_of_the_day.py
@@ -188,7 +188,7 @@ class QuestionOfTheDay(commands.Cog):
(hour_after_midnight_utc, minute_after_hour)
] = {ctx.guild.id: 1}
await ctx.reply(
- f"The bot will post the question of the day {hour_after_midnight_utc:0>2}:{minute_after_hour:0>2} hours after midnight UTC."
+ f"The bot will post the question of the day at {hour_after_midnight_utc:0>2}:{minute_after_hour:0>2} UTC."
)
else:
await ctx.reply(
@@ -321,14 +321,20 @@ class QuestionOfTheDay(commands.Cog):
async with self.config.guild(guild).questions() as questions:
questions_len = len(questions)
if not questions_len:
- await channel.send("# Question of the Day\n**No questions left!**")
+ await channel.send("**Question of the day: no questions left!**")
else:
question_index = random.randrange(0, questions_len)
question = questions[question_index]
+ asked_by = await guild.fetch_member(question["asked_by"])
+ allowed_mentions = discord.AllowedMentions.none()
+ allowed_mentions.users = [asked_by]
message = await channel.send(
- f"# Question of the Day\n"
- f"{question['question']}\n{redbot.core.utils.chat_formatting.italics((await guild.fetch_member(question['asked_by'])).name)}"
- f" ({question['asked_by']})"
+ f"**Question of the day:** "
+ f"{question['question']}\n"
+ + redbot.core.utils.chat_formatting.italics(
+ "asked by " + asked_by.mention
+ ),
+ allowed_mentions=allowed_mentions,
)
del questions[question_index]
await self.manage_qotd_pins(message)
@@ -368,7 +374,8 @@ class QuestionOfTheDay(commands.Cog):
"\n".join(
[
f"{i + 1}. {redbot.core.utils.chat_formatting.bold(question['question'])} by "
- f"{redbot.core.utils.chat_formatting.bold(str(await ctx.guild.fetch_member(question['asked_by'])) + ' (' + str(question['asked_by']) + ')')}"
+ + (await ctx.guild.fetch_member(question["asked_by"])).name
+ + f" ({question['asked_by']})"
for i, question in enumerate(questions)
]
)