This is a simple Discord bot that responds to various commands, including handling user questions via an external API.
- Ping: Responds with the bot's latency.
- Say/Repeat: Echoes back a given message.
- Help: Provides information on available commands.
- Ask: Answers user questions using an external API.
-
Clone the repository:
git clone https://github.com/Exched/Discord_ai.git cd my-discord-bot
-
Install dependencies:
npm install
-
Create a configuration file:
- Create a
config.json
file in the root directory with the following content:
{ "intents": ["GUILDS", "GUILD_MESSAGES"], "prefix": "!", "token": "YOUR_DISCORD_BOT_TOKEN", "apiKey": "YOUR_API_KEY", "apiUrl": "https://api.example.com/answer" }
- Replace
YOUR_DISCORD_BOT_TOKEN
with your bot's token from the Discord Developer Portal. - Replace
YOUR_API_KEY
with your API key for the external API. - Replace
https://api.example.com/answer
with the actual URL of the external API.
- Create a
-
Run the bot:
node index.js
-
Commands:
!ping
: Responds with "Pong!" and the round trip latency.!say <message>
or!repeat <message>
: Echoes back the provided message.!help
: Displays an embed with available commands.!ask <question>
: Sends the question to the external API and replies with the answer.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Open a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.