Skip to content
This repository was archived by the owner on Oct 5, 2025. It is now read-only.
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ import (
"github.com/wpi-25/scribe/middleware"
)

type BotContext struct {
Invites map[string][]*discordgo.Invite
}

var BotCtx BotContext

func main() {
err := godotenv.Load()
if err != nil {
Expand Down Expand Up @@ -53,11 +59,28 @@ func main() {
// Add command handler to message listener
router.Initialize(s)

s.StateEnabled = true

err = s.Open()
if err != nil {
log.Fatalln(err)
}

BotCtx = BotContext{}
for _, guild := range s.State.Guilds {
log.Println(fmt.Sprintf("Storing invites for %s", guild.Name))
for _, chann := range guild.Channels {
invs, err := s.ChannelInvites(chann.ID)
if err != nil {
log.Println(err)
} else {
for _, inv := range invs {
_ = append(BotCtx.Invites[guild.ID], inv)
}
}
}
}

log.Println("Bot running")
// Keep the bot running
<-make(chan struct{})
Expand Down