Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/onesoft-sudo/sudobot/llms.txt

Use this file to discover all available pages before exploring further.

The AFK system gives members a simple way to communicate that they are temporarily unavailable. When a member sets their AFK status, SudoBot records it in the database and caches it in memory. Any subsequent mention of that user triggers a reply explaining they are AFK and, if provided, why. As soon as the AFK member sends any message in the server, the bot clears their status and replies with a summary of how many times they were mentioned and by whom.

How it works

AFKService maintains an in-memory Collection keyed by guildId::userId (or global::userId for global AFK entries). On every message, the service checks two things:
  1. Whether the author of the message is currently AFK — if so, their status is cleared and a summary is sent.
  2. Whether any mentioned users are AFK — if so, a reply lists each AFK user with their reason and how long ago they went AFK.
Mention records are batched and written to the database on a 7-second debounced timer to avoid excessive writes.

Using the /afk command

/afk [reason] [global]
OptionTypeRequiredDescription
reasonstringNoWhy you are AFK. Shown to anyone who mentions you. Maximum 1024 characters.
globalbooleanNoWhen true, your AFK status applies across all servers SudoBot is in, not just the current one.
The legacy prefix command gafk sets a global AFK status by default.
Your reason is validated against the server’s active message rules. If the text triggers an automod rule, the command fails and your status is not set.

Setting an AFK status

1

Run the command

Use /afk with an optional reason. SudoBot confirms your status in an embed.
/afk reason: Working on a project, back in 2 hours
2

Receive mention notifications

While you are AFK, anyone who mentions you sees a reply like:
@You is AFK, for reason: Working on a project, back in 2 hours — 5 minutes ago.
Each mention is recorded with the mentioner’s ID, channel, message, and timestamp.
3

Return and get your summary

The next time you send a message, SudoBot automatically removes your AFK status and replies with a summary embed:
  • Total mention count across guild and global records.
  • Up to 25 recent mentions, each with a “Navigate” link to the original message.
  • The total duration you were AFK.

AFK scope: guild vs global

The default behavior. Your status is recorded for the current server only. Mentions in other servers do not trigger notifications.
/afk reason: Lunch break
Internally the entry is stored with guildId set to the current guild’s snowflake.

Switching AFK context

If you already have an AFK entry set and run /afk again with the opposite global setting, SudoBot does not create a duplicate entry — it switches the context of your existing record between guild-local and global, and confirms the switch.

Mention tracking details

The service stores up to 25 mention records per AFK entry. When the cap is reached, the oldest mention is discarded to make room for the new one. Each record captures:
  • The ID of the user who mentioned you.
  • The guild, channel, and message IDs.
  • An ISO timestamp.
When you return, your summary includes links that navigate directly to each message.

Re-invoking /afk while already AFK

If you are already AFK and run /afk again, the service clears your status immediately and shows the mention summary. This gives you an explicit way to mark yourself back without waiting to send a regular message.

Queue & Scheduling

Schedule commands and reminders for a future time.

Fun Commands

Lighten the mood with cat images, jokes, and emoji mixing.

Build docs developers (and LLMs) love