all repos — disgord @ 451c462955a02ed969386fe816392b8e1fc1cfe2

A simple Discord bot in Go.

src/globals/globals.go (view raw)

 1package globals
 2
 3import (
 4	"os"
 5
 6	"github.com/BiRabittoh/disgord/src/myconfig"
 7	"github.com/BiRabittoh/disgord/src/mylog"
 8	"github.com/bwmarrin/discordgo"
 9)
10
11const (
12	MsgError      = "Something went wrong."
13	MsgHelpFmt    = "%s - _%s_"
14	defaultPrefix = "$"
15)
16
17var (
18	CommitID string
19	Config   *myconfig.Config[MyConfig]
20
21	logger = mylog.NewLogger(os.Stdout, "main", mylog.DEBUG)
22)
23
24type KeyValuePair struct {
25	Name  string `json:"name"`
26	Value string `json:"value"`
27}
28
29type MyConfig struct {
30	ApplicationID string `json:"applicationId"`
31	Token         string `json:"token"`
32
33	Prefixes []KeyValuePair `json:"prefixes"`
34	Outros   []KeyValuePair `json:"outros"`
35	Radios   []KeyValuePair `json:"radios"`
36
37	MagazineSize uint `json:"magazineSize"`
38}
39
40type BotCommand struct {
41	Handler   func([]string, *discordgo.Session, *discordgo.MessageCreate) string
42	ShortCode string
43	Help      string
44}