Ask requires a Discord application, a bot token, and an OpenAI API key. Use Node.js 26 or later and npm 12 or later for a local install.
- Create an application in the Discord Developer Portal.
- Add a bot to the application and copy its token.
- Copy the application ID from the application page.
- Enable the privileged Message Content intent on the Bot page.
- Invite the bot with the
botandapplications.commandsscopes. - Grant View Channels, Send Messages, and Read Message History in each server channel where Ask can send replies.
Ask requires the Message Content intent for message triggers and channel context. Do not grant Administrator permission.
- Clone the repository and open its root directory.
- Copy
.env.exampleto.env. - Set
DISCORD_CLIENT_ID,DISCORD_TOKEN, andOPENAI_API_KEYin.env. - Run
npm cito install the locked dependencies. - Run
node bin/ask.mjsto start Ask. - Invite the bot to a test server before you try server commands.
See Configuration for each value and Commands for ways to use Ask.
Send SIGINT or SIGTERM to the process. Ask closes its Discord client during shutdown.
Ask sends the current question and no more than 100 recent text messages from the channel to the OpenAI API. Those messages can include content from other channel members. The API request sets store to false. Get agreement from message authors before using Ask with private channel content. Discord receives the response in the channel or direct message that started the request.