Skip to content

Commit

Permalink
Add a warning if the guilds array is empty, this indicates the bot ha…
Browse files Browse the repository at this point in the history
…s not been invited to any servers and so hands out the invite link (#42)
  • Loading branch information
ezelkow1 committed Nov 5, 2020
1 parent c51ed82 commit 9fffe55
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,15 @@ func ready(s *discordgo.Session, event *discordgo.Ready) {
s.UpdateStatus(0, "")
//SendEmbed(s, config.BroadcastChannel, "", "I iz here", "Keybot has arrived. You may now use me like the dumpster I am")
if config.KeyRole != "" {
guildID = event.Guilds[0].ID
refreshRoles(s)
if len(event.Guilds) > 0 {
guildID = event.Guilds[0].ID
refreshRoles(s)
} else {
fmt.Println("Error: No servers returned from discord. Make sure to invite your bot to your server first")
fmt.Println("Error: You can do that with https://discord.com/oauth2/authorize?client_id=123451234512345&scope=bot")
fmt.Println("Error: Replace the number with your bot's clientid value from your developer portal")
os.Exit(4)
}
}

initialized = true
Expand Down

0 comments on commit 9fffe55

Please sign in to comment.