Go Discord Bot Hosting
Go bots are small and fast, which makes them some of the cheapest bots to keep online. Upload your source and go.mod, and the server builds a binary on Go 1.22 and runs it.
Because Go compiles ahead of time, the build happens when the server installs. After you change your code, use Reinstall to build the new version.
- Go version
- 1.22
- Build
- go mod download and go build at install
- Updates
- Upload new code, then Reinstall
- Libraries
- discordgo, arikawa and more
A bot that runs here as it is
A minimal discordgo bot. Run go mod init and go get github.com/bwmarrin/discordgo, and set the go line in go.mod to 1.22.
package main
import (
"log"
"os"
"os/signal"
"syscall"
"github.com/bwmarrin/discordgo"
)
func main() {
dg, err := discordgo.New("Bot " + os.Getenv("DISCORD_TOKEN"))
if err != nil {
log.Fatal(err)
}
dg.AddHandler(func(s *discordgo.Session, r *discordgo.Ready) {
log.Printf("Ready as %s", r.User.Username)
})
if err := dg.Open(); err != nil {
log.Fatal(err)
}
defer dg.Close()
stop := make(chan os.Signal, 1)
signal.Notify(stop, syscall.SIGINT, syscall.SIGTERM)
<-stop
}How to host a Go Discord bot on Zeros Host
- 1
Create the bot in the Discord Developer Portal
Go to discord.com/developers/applications, create an application, open the Bot tab and press Reset Token to copy your token. Under OAuth2, pick the bot and applications.commands scopes, choose the permissions your bot needs, and open the generated link to add the bot to your server.
- 2
Create a Go bot server
Start a free trial or pick a Discord Bot plan and choose Go.
- 3
Add your bot token
Open the Startup page for your server and paste your token into Discord Token. The panel passes it to your bot as the DISCORD_TOKEN environment variable, so it never has to sit inside your code or your Git repository.
- 4
Upload main.go, go.mod and go.sum
Upload your source files and both module files to the root of the server in the File Manager.
- 5
Reinstall to build
Open Settings and press Reinstall. The install downloads your modules and runs go build, producing the bot binary that the server starts.
go mod download go build -o bot .
- 6
Start it
Press Start and check the console for your ready log. Repeat the upload and Reinstall whenever you change the code.
Common Go bot errors and fixes
go.mod requires go >= 1.23
The server builds with Go 1.22. Change the go line in go.mod to 1.22 and pin any dependency that needs a newer Go to an older release, then Reinstall.
No go.mod found
The install could not see go.mod at the top of the server. Upload it next to main.go, not inside a subfolder, and Reinstall.
The bot runs old code after an upload
Go only rebuilds during install. Press Reinstall after uploading new code.
Used disallowed intents
Your code asks for a privileged intent (Message Content, Server Members or Presence) that is switched off for your bot. Turn it on under Bot, Privileged Gateway Intents in the Developer Portal, or remove it from your code.
An invalid token was provided
The token in Discord Token is wrong or was reset. Reset it in the Developer Portal, paste the new one on the Startup page and restart. Discord also resets tokens it finds in public GitHub repositories, so keep yours out of your code.
Which plan fits
Go bots are lean. Most run happily on Starter at 256 MB, even in a good number of servers.
Starter
£1/mo
256 MB RAM · 5 GB
Suggested for this bot
Standard
£3/mo
512 MB RAM · 10 GB
Pro
£5/mo
1 GB RAM · 15 GB
Enterprise
£6/mo
2 GB RAM · 25 GB
Try it free for 48 hours
Start a 48-hour Discord bot trial with no card needed. Pick your runtime and your server is ready in seconds. Plans start at £1 a month after that.
Frequently asked questions
Will a Reinstall delete my files?
Take a backup first to be safe. The Reinstall reruns the install, which builds your uploaded code; keep any data your bot writes in a folder you back up.
Can I upload a binary I built myself?
Yes. Build for Linux amd64, name the file bot and upload it to the server root. The server starts ./bot.