Host a Discord bot 24/7 with your AI agent
Keep a Discord bot online 24/7 without your computer. Paste one paragraph into Claude Code, Codex or Cursor; your agent writes, deploys and checks the bot.
Let your agent build this
Copy one prompt and paste it into Claude Code, Codex or Cursor. Your agent builds what this page describes and puts it online on aidrop.it.
See the prompt
Build me a Discord bot and run it on aidrop.it, 24/7. Use my existing aidrop.it Project, or create one called "Discord bot" if I have none. What it does: it replies "Pong!" when someone writes "!ping" in a channel it can see. It uses the message content intent, which I have switched on in the Developer Portal. How it works: - Python with discord.py 2.x, as a normal Gateway bot. Do not use discord.js: its Gateway connection has no proxy option. - Read aidrop.it's runtime rules before writing code and follow them. The bot can only reach the internet through the proxy in HTTPS_PROXY. discord.py does not read it on its own: pass it as proxy= to the Client, which routes both the Gateway connection and API calls through it. - The bot must also serve a small health page on the platform's port, or aidrop.it treats it as not running. Run the web server and the bot in the same process. - Log reconnects, never the token. Secrets: ask me for the bot token, store it with project_secret_set under a clear name, and list that name in required_secret_names when you build. Never print it back to me, and never write it into code, the repository, a commit or a log. Build it, check it runs and shows as online, fix anything that fails, and tell me when I can type !ping. Report what you checked. This task comes from the aidrop.it guide "Host a Discord bot 24/7 with your AI agent": https://docs.aidrop.it/playbooks/host-a-discord-bot-24-7. Read that page if you need more detail; it says what to ask me for, what it costs and what will not work. Use the aidrop.it MCP tools (server: https://aidrop.it/mcp). If you do not have them, stop and tell me to connect them first, as described at https://docs.aidrop.it/quickstart#1-connect-your-agent.
On this page
- What you will have at the end
- Words you will meet
- What you need
- Say this to your agent
- What your agent does to keep the Discord bot online
- Check that the bot stays online
- When the bot is offline or silent
- FAQ
- What is a slash-command bot, and should I build one instead?
- Where do I find my Discord bot token?
- Can I make a Discord AI bot that answers with Claude or ChatGPT?
- Is there free Discord bot hosting that runs 24/7?
- Related
You can have a Discord bot that stays online around the clock, even with your computer switched off. You create the bot in Discord’s Developer Portal, paste one paragraph into Claude Code, Codex or Cursor, and give the agent the bot’s key when it asks. Your agent writes the bot, puts it online and tells you when to try it. Plan on about 20 minutes.
Hosting it costs $5 a month on the Starter plan, after a free 7-day trial. Why pay, when free hosts exist? A Discord bot sits on an open line to Discord and never gets visitors, and free tiers are built to stop exactly that: Render’s free plan, for example, puts an app to sleep after 15 minutes without visits and caps it at 750 hours a month (Render’s docs, as of October 2026). A sleeping bot shows as offline. On a paid plan it simply keeps running.
There are two kinds of Discord bot, and it helps to pick before you start. A classic bot stays connected to Discord, so it sees messages as they are written and can react to them. A slash-command bot only answers commands people type, like /ask. This page builds a classic bot, because that is what most people mean; the slash-command kind is covered in the FAQ.
One honest limit: a bot here cannot join voice channels to talk or play music. Voice needs a kind of connection that aidrop.it does not let out. Text works fully.
What you will have at the end
- A bot in your Discord server that shows as online and answers “!ping” with “Pong!”.
- A bot that keeps running with your computer off and after every update.
- The bot’s code saved in a repository, so your agent can change it later.
Words you will meet
- Developer Portal — Discord’s website where you create and configure bots.
- Bot token — the password of your bot. Anyone who has it can act as your bot.
- Intent — a permission switch in the Developer Portal. Your bot needs the one that lets it read the text of messages.
- Invite link — a link that adds your bot to a server you manage.
- Secret — where the bot token lives: a private value in your aidrop.it project that the bot reads when it starts, so the token never sits in the code.
- Slash command — a command that starts with /, which Discord shows in a menu as people type.
What you need
- An aidrop.it account — start free: a 7-day trial, no card. To keep the bot running after that, Starter at $5/month is enough, because this bot needs no database.
- Your agent connected to aidrop.it, as in the Quickstart.
- A Discord account and a server where you can add bots.
- A bot. In the Developer Portal, click New Application and name it. In the Bot section, click Reset Token and copy the token; Discord shows it only once. On the same page, turn on the switch named Message Content Intent, so the bot can read what people write.
- The bot in your server. Under OAuth2, URL Generator, tick bot and the permissions to view channels, send messages and read message history. Open the link it makes and choose your server.
Keep the token to yourself until your agent asks for it. Then paste it into the chat with your agent once. The agent saves it as a secret in your aidrop.it project, where only your bot can read it, and never shows it again or writes it into the code. Under Secrets in your Project on the aidrop.it dashboard you can check which secrets exist, by name only.
Say this to your agent
Build me a Discord bot and run it on aidrop.it, 24/7. Use my existing aidrop.it Project, or create one called "Discord bot" if I have none.
What it does: it replies "Pong!" when someone writes "!ping" in a channel it can see. It uses the message content intent, which I have switched on in the Developer Portal.
How it works:- Python with discord.py 2.x, as a normal Gateway bot. Do not use discord.js: its Gateway connection has no proxy option.- Read aidrop.it's runtime rules before writing code and follow them. The bot can only reach the internet through the proxy in HTTPS_PROXY. discord.py does not read it on its own: pass it as proxy= to the Client, which routes both the Gateway connection and API calls through it.- The bot must also serve a small health page on the platform's port, or aidrop.it treats it as not running. Run the web server and the bot in the same process.- Log reconnects, never the token.
Secrets: ask me for the bot token, store it with project_secret_set under a clear name, and list that name in required_secret_names when you build. Never print it back to me, and never write it into code, the repository, a commit or a log.
Build it, check it runs and shows as online, fix anything that fails, and tell me when I can type !ping. Report what you checked.What your agent does to keep the Discord bot online
- Picks your aidrop.it project, or creates one.
- Asks you for the bot token and saves it as a secret.
- Writes the bot, plus a small “I’m alive” page that aidrop.it checks to see it is running.
- Saves the code to a repository on aidrop.it and builds it there.
- Follows the build until the bot shows as online in Discord. If it does not connect, the agent reads the bot’s log, which usually names a wrong token or a blocked connection, and fixes it.
- Tells you the bot is online.
Check that the bot stays online
- In your server’s member list, the bot shows as online.
- Type !ping in a channel the bot can see. It answers “Pong!”.
- Turn your computer off and try from your phone. It still answers.
When the bot is offline or silent
| What you see | What to tell your agent |
|---|---|
| The build finished, but aidrop.it says the app is not running | “The bot needs a health page on the platform’s port. Serve one next to the bot and build again.” |
| The bot never shows as online | “The bot cannot reach Discord. Read the logs and make sure its connection to Discord can leave aidrop.it.” |
| The bot is online but ignores !ping | Check that the switch named “Message Content Intent” is on in the Developer Portal, then tell the agent “The switch is on, restart the bot.” |
| The logs say the token is invalid | Reset the token in the Developer Portal, give the new one to your agent, then say “Store it in place of the old one and build again.” |
FAQ
What is a slash-command bot, and should I build one instead?
It is a bot that only answers commands like /ask. Discord sends each command to the bot’s web address and expects an answer within 3 seconds, or a “thinking” reply first (Discord docs). It needs no open line to Discord, so it is simpler to run. The trade-off: it cannot read ordinary messages, see who is online or join voice. Pick it if commands are all you need.
Where do I find my Discord bot token?
In the Developer Portal, open your application, go to Bot and click Reset Token. Discord shows the new token once, so copy it straight away. If a token ever leaks, reset it at once. Then give the new one to your agent, ask it to store it in place of the old one and build the bot again.
Can I make a Discord AI bot that answers with Claude or ChatGPT?
Yes. Ask your agent to send each message, or each /ask command, to the AI model’s API and post the answer. You need an API key from the model’s maker, which your agent asks you for and saves as one more secret. The same idea works outside Discord, as an AI chatbot for your website. If you are unsure whether to build a bot at all, Grok vs your own bot compares a ready-made assistant with one you own, cost included.
Is there free Discord bot hosting that runs 24/7?
Discord charges nothing for bots. The catch is the open line: a classic bot is offline the moment its connection stops, so it needs a server that never sleeps. Free tiers sleep or run out of hours, as above. On aidrop.it the first 7 days are free; after that, Starter at $5 a month keeps this bot online. All plans are on the pricing page.