How to set up a Discord AFK bot
A Discord AFK bot status lets someone leave a short explanation before stepping away, then lets others see that explanation when they mention that person. Build Discord Bots includes AFK in the Free Tools & Utilities module, with no dashboard configuration required. This guide sets a status, checks a mention notice from a second member, and confirms the return behavior. It also covers the important limit: AFK statuses live in the bot’s memory, so they are not a durable absence calendar or a record that survives a bot restart.
Start freeStart free. Pro is $9.99/month.
Before you start
- Have an online bot in a server you manage with Tools & Utilities enabled. The module is included on the Free plan and works with its default settings.
- Use a quiet test channel and two consenting members or accounts: one to set AFK and another to mention them. The bot needs to read and send messages in that channel.
Enable the free Tools & Utilities module
Open the bot’s Modules tab, enable Tools & Utilities, and wait until the bot is online before testing. The module has no configurable settings; its commands use their default behavior. AFK is Free, so you do not need to change a plan setting for this workflow. Use a test channel at first because the module replies when a status is set, when someone mentions an AFK member, and when that member sends a message again.
Check the command prefix before you start. This guide uses the default ! prefix; replace it with your bot’s configured prefix if it differs. The AFK command accepts an optional reason, so no reason is required to set a basic status. Do not confuse a Discord voice-channel AFK setting with this feature: this module tracks a text-command status for members in a server and responds to message activity.
Set a short AFK status with a useful reason
From the first test account, enter `afk Lunch break`. The bot stores that member’s status for the current server and replies with an embed showing the reason. Keep the reason brief and appropriate for the channel because it can be shown to people who mention the member. If you enter `afk` without text, the stored reason defaults to AFK. A status is per member and per server, not a server-wide announcement.
Run the command only once during the first check. If the same member uses `afk` again while their status is still stored, the handler removes the status instead of replacing its reason. To change a reason, first use the command to clear the existing status, then use it again with the new text. This toggle behavior is worth explaining to members so an attempt to update a status does not accidentally mark them as back.
Test the mention notice from another member
From the second test account, send an ordinary message that mentions the AFK member. The listener checks mentions in messages from non-bot users and replies with the AFK member’s stored reason and elapsed time. Confirm that the notice names the intended person and matches the test reason. Mentioning someone is the trigger; merely writing their display name is not the same test.
The mention notice is temporary: the handler attempts to delete that reply after eight seconds. Check the response promptly, then give it time to disappear. If no notice appears, verify that the AFK command was issued in the same server, the bot can read and reply in the channel, and the second account used a real Discord mention. Do not rely on the brief reply as an audit log or permanent scheduling system.
Confirm the return message and automatic clear
Have the AFK member send a normal message in the server. Before checking mentions, the listener sees that the author is AFK, removes that status, and posts a return message with the elapsed duration. The return message is also temporary and is scheduled for deletion after five seconds. This means any normal message from the AFK member clears their status; there is no separate back command.
After the return notice, have the second account mention the member again. There should no longer be an AFK notice because the status was removed. If the member wants to remain away after accidentally sending a message, they can set a new status with `afk` and a reason. Treat the behavior as a convenience signal for a conversation, not evidence that someone is available or unavailable at a particular time.
Know the privacy and restart boundaries
AFK data is held in the module’s in-memory map, organized by server and member. It is not written as a durable absence record by this handler. If the bot process restarts, its new module instance starts without the earlier AFK statuses. Test this expectation in a disposable environment only if you control the restart; do not restart a production bot merely to test an AFK message. Members can set a fresh status when the bot is online again.
The listener ignores bot-authored messages and messages outside a server. It shows the stored reason to people who mention the AFK member, so discourage members from using sensitive details in a reason. A short phrase such as “Away for lunch” is usually more appropriate than a location, contact detail, or health explanation. Server moderators should set expectations about which channels are suitable for AFK status messages if a busy community finds the replies distracting.
Publish a simple AFK workflow for members
Post one small instruction in the channel where members usually coordinate: use `afk` with an optional reason before stepping away, and send any normal message on return. Ask members to keep reasons concise because mention notices repeat them. If the bot’s prefix changes, update the instruction at the same time. A clear two-step explanation is easier to follow than a long list of tools that are unrelated to a temporary status.
Keep testing separate from other Tools & Utilities commands such as weather, which contacts an external service. AFK itself does not need an external provider or a dashboard setting. If the reply is missing, check module activation, bot availability, prefix, and channel permissions before promising a different feature. Once the mention and return tests work as expected, use the signup button below to add this free utility to your own hosted bot.
Frequently asked questions
Is the Discord AFK bot feature free?
Yes. AFK is part of the Free Tools & Utilities module.
How do I clear my AFK status?
Send a normal message in the server. The AFK listener removes your status and posts a temporary return message.
Why did my AFK status disappear after a restart?
The current handler keeps AFK statuses in memory. A new bot process starts with a new, empty status list.
Can I change my AFK reason?
The afk command toggles an existing status off. Clear the existing status first, then run it again with the new reason.
