How to create a Discord bot

Requirements
- Install required software
- Git
- Go
- Visual Studio Code
- Go for Visual Studio Code
- Create a new repository on GitHub
- Please refer to package-names to
name the repository
- Add
.gitignore: Go
- Connect to GitHub with SSH
by reading the following documents
- Understand the GitHub flow
- Learn Go by reading the following documents
- Discord
- Read the introduction to the Discord Developer Portal
- Create an application
Setup the repository
- Download the newly created GitHub repository using
git clone via SSH
- Open the folder with VSCode
- Create a file named
main.go
In main.go, paste the following.
package main
func main() {
}
In the following commands, you'll need to use the URL of the GitHub repository
you've just created in the format github.com/NatoBoram/godiscordbot.
go mod init github.com/NatoBoram/godiscordbot
go get -u -v github.com/bwmarrin/discordgo
Once you have something in the repository, commit it and send it to the GitHub
repository. Use VSCode's Source Control tab to help you out.
Coding something
Use discordgo to get started.
The full documentation is at pkg.go.dev/github.com/bwmarrin/discordgo.
Remember that your token should not be stored inside your source code, but
instead be in a configuration file.