Packages
To organize your code and make it readable, you can use go packages.
Depending on what you're using, you can create packages for each:
Slash Commands.
Events.
Modals.
Autocomplete.
etc.
For example, to move slash commands to packages, create a SlashCommands directory and put ping.go in it:
DIR | SlashCommands
File | ping.go
File | main.goSlashCommands/ping.go
package SlashCommands
import (
"github.com/bwmarrin/discordgo"
)
func Ping(s *discordgo.Session, i *discordgo.InteractionCreate) {
// send ping
}
main.go:
The same procedure for all commands, modals, etc.
Last updated
Was this helpful?