Skip to content

fix(afk): make afk command responses ephemeral #847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tux/cogs/utility/afk.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@ async def afk(

await add_afk(self.db, shortened_reason, target, ctx.guild.id, False)

await ctx.send(
await ctx.reply(
content="\N{SLEEPING SYMBOL} || You are now afk! " + f"Reason: `{shortened_reason}`",
allowed_mentions=discord.AllowedMentions(
users=False,
everyone=False,
roles=False,
),
ephemeral=True,
)

@commands.hybrid_command(name="permafk")
Expand All @@ -84,7 +85,7 @@ async def permafk(self, ctx: commands.Context[Tux], *, reason: str = "No reason.
entry = await self.db.afk.get_afk_member(target.id, guild_id=ctx.guild.id)
if entry is not None:
await del_afk(self.db, target, entry.nickname)
await ctx.send("Welcome back!")
await ctx.send("Welcome back!", ephemeral=True)
return

shortened_reason = textwrap.shorten(reason, width=100, placeholder="...")
Expand All @@ -99,6 +100,7 @@ async def permafk(self, ctx: commands.Context[Tux], *, reason: str = "No reason.
everyone=False,
roles=False,
),
ephemeral=True,
)

@commands.Cog.listener("on_message")
Expand Down