Consider giving this a ⭐ to show your support! <3
Welcome to the Open-Source Discord Go Bot Template! This project is built using Go and comes with everything you need to get started on building your own Go powered discord bot. For a more detailed breakdown look at our Documentation.
- 🔒 Secure Configurations – Environment-based
.env
file setup - 📦 Modular Design – Easily extend and customize features
-
Clone the Repository:
gh https://github.com/ResyncedDesign/DiscordGoBot.git <folder-name> cd <folder-name>
-
Install Dependencies:
Run one of the following commands to install all required packages:
go mod tidy
-
Set Up Environment Variables:
Create a
.env
file in the root directory with the following structure:TOKEN=your_discord_bot_token CLIENTID=your_discord_application_client_id GUILDID=your_discord_guild_id
-
Build and Start the Bot:
Compile the bot and start it using:
go build -o bot main.go ./bot
To invite the bot to your Discord server, follow these steps:
Note
Ensure you select all the intents for the bot to work.
-
Go to your Discord application's OAuth2 section in the Discord Developer Portal.
-
Generate an invite link using the bot's Client ID with the required scopes and permissions. Example link:
https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=8&integration_type=0&scope=applications.commands+bot
-
Replace
YOUR_CLIENT_ID
with theCLIENT_ID
from your.env
file. -
Open the link in a browser and add the bot to your desired server.
To start customizing, edit the files in the src
directory. Key files include:
main.go
– Main entry point for the bot.src/commands/categories
– Directory containing bot commands (add new commands here).src/events/categories
– Directory containing bot events (add new events here).src/types
– Directory containing custom types and interfaces.src/config
– Directory containing configuration files and environment variables.
Changes will take effect after rebuilding the project using:
go build -o bot main.go
./bot
OR you can use the following command to run the bot:
go run main.go
Contributions are welcome! Feel free to fork the repository and submit pull requests for improvements or new features.
If you have ideas for improving this bot or encounter any issues, feel free to open an issue or reach out. Happy coding! 🎉