all repos — disgord @ 41b487beb8025d82e480ed8899f028ac2d381a06

A simple Discord bot in Go.

src/globals.go (view raw)

 1package src
 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	"github.com/kkdai/youtube/v2"
10)
11
12const (
13	msgError      = "Something went wrong."
14	helpFmt       = "%s - _%s_"
15	defaultPrefix = "$"
16)
17
18var (
19	CommitID string
20	Config   *myconfig.Config[MyConfig]
21
22	logger = mylog.NewLogger(os.Stdout, "main", mylog.DEBUG)
23	yt     = youtube.Client{}
24)
25
26type KeyValuePair struct {
27	Name  string `json:"name"`
28	Value string `json:"value"`
29}
30
31type MyConfig struct {
32	ApplicationID string `json:"applicationId"`
33	Token         string `json:"token"`
34
35	Prefixes []KeyValuePair `json:"prefixes"`
36	Outros   []KeyValuePair `json:"outros"`
37	Radios   []KeyValuePair `json:"radios"`
38
39	MagazineSize uint `json:"magazineSize"`
40}
41
42type BotCommand struct {
43	Handler   func([]string, *discordgo.Session, *discordgo.MessageCreate) string
44	ShortCode string
45	Help      string
46}