fix some minor issues with slash command registering

This commit is contained in:
vel 2021-08-16 22:12:20 -07:00
parent cafc1b7e64
commit 8e2b31059a
Signed by: velvox
GPG Key ID: 1C8200C1D689CEF5
1 changed files with 17 additions and 6 deletions

23
core.go
View File

@ -43,6 +43,10 @@ var botAdmins = make(map[string]bool)
// Similar to BotAdmins, this isn't saved to .json and is added programmatically // Similar to BotAdmins, this isn't saved to .json and is added programmatically
var botToken = "" var botToken = ""
// BotTestingId
// A string of the testing guild. Used for slash commands
var botTestingId = ""
// ColorSuccess // ColorSuccess
// The color to use for response embeds reporting success // The color to use for response embeds reporting success
var ColorSuccess = 0x55F485 var ColorSuccess = 0x55F485
@ -73,6 +77,12 @@ func SetToken(token string) {
botToken = token botToken = token
} }
// SetTestingId
// A function that allows a single id to be added, but not removed
func SetTestingId(token string) {
botTestingId = token
}
// IsAdmin // IsAdmin
// Allow commands to check if a user is an admin or not // Allow commands to check if a user is an admin or not
// Since botAdmins is a boolean map, if they are not in the map, false is the default // Since botAdmins is a boolean map, if they are not in the map, false is the default
@ -173,16 +183,17 @@ func Start() {
if numAdmins == 0 { if numAdmins == 0 {
log.Warning("You have not added any bot admins! Only moderators will be able to run commands, and permissions cannot be changed!") log.Warning("You have not added any bot admins! Only moderators will be able to run commands, and permissions cannot be changed!")
} }
// Register slash commands
//slashChannel := make(chan string) //Register slash commands
//log.Info("Registering slash commands") slashChannel := make(chan string)
//go AddSlashCommands("833901685054242846", slashChannel) log.Info("Registering slash commands")
go AddSlashCommands(botTestingId, slashChannel)
// Bot ready // Bot ready
log.Info("Initialization complete! The bot is now ready.") log.Info("Initialization complete! The bot is now ready.")
// Info about slash commands //Info about slash commands
//log.Info(<-slashChannel) log.Info(<-slashChannel)
// -- GRACEFUL TERMINATION -- // // -- GRACEFUL TERMINATION -- //