This is a Discord bot written on JavaScript. It have two global commands: ping.js and dolar.js. Both are in src/commands.
To test these commands with my bot, invite it on your server by clicking here or setting it with configuration instructions and deploying this bot on Heroku.
To create your own commands. See the section Command Configuration.
This app has been made with Discord.js and based on Discord.js Guide and here are other libraries and resources:
Clone repository
git clone https://github.com/agustinbarbalase/bot-discord.git
Create your bot here and follow the instructions here. Then, add your bot on your server with the following URL, DON'T FORGET COPY AND PASTE THE CLIENT ID
https://discord.com/oauth2/authorize?client_id=CLIENT_ID&scope=bot+applications.commands
Create a .env file on your repository with the following options:
DISCORD_TOKEN=your-token-gone-here
DISCORD_CLIENT_ID=your-client_id-gone-here
DISCORD_GUILD_ID=your-guild_id-gone-here (Optional)
npm install
npm startnpm install
npm run devFor these steps, you must add in your .env file the following option:
DISCORD_GUILD_ID=your-guild_id-gone-here
These commands are still executed, if you keep the execution on your computer or deployment. These commands will not work if you configure my bot on your server and follow the following steps.
If you want deploy this bot on Heroku. Check the section Deploy on Heroku
Once you clone and configure this repo on your computer or deploy it. You can configure the commands on your server.
First, create a command in your repo. The command should be on src/commands. The format of your commands should be:
module.exports = {
name: 'your-name-command',
description: 'your-description-command',
async execute(interaction) {
// command execution
}
}And then, you must execute the command:
node ./src/api/putAplicationGuildCommands.jsIf you clone the repo and you want to deploy your own bot on Discord, and you want all your commands on all servers, then you must run the following command and wait 1 hour:
node ./src/api/putAplicationCommands.jsFor deployment. Check the section Deploy on Heroku, if you want to deploy on Heroku.
This application was deployed in Heroku with Github actions. To test my bot on your server with global commands, click here or use the following action to deploy your own bot on Heroku:
name: Deploy bot to Heroku
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.12.12
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: ${{ secrets.HEROKU_APP_NAME }}
heroku_email: ${{ secrets.HEROKU_EMAIL }}
procfile: 'worker: npm start'
env:
HD_DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
HD_DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }}This app has an MIT License