diff --git a/bot/qilbot.go b/bot/qilbot.go index 095b615..3159bde 100644 --- a/bot/qilbot.go +++ b/bot/qilbot.go @@ -9,10 +9,11 @@ type Qilbot struct { // Privates - stopChannel chan struct{} - config *QilbotConfig - session *DiscordSession - commands map[string]*CommandInformation + stopChannel chan struct{} + config *QilbotConfig + session *DiscordSession + commands map[string]*CommandInformation + commandSettings map[string]*commandSettings } // QilbotConfig representation of the configuration for qilbot. diff --git a/bot/qilbot_func.go b/bot/qilbot_func.go index 55f87fc..a6e7b40 100644 --- a/bot/qilbot_func.go +++ b/bot/qilbot_func.go @@ -10,10 +10,11 @@ import ( // New creates a new instance of Qilbot func New(config *QilbotConfig) (bot *Qilbot, err error) { bot = &Qilbot{ - config: config, - Plugins: []IPlugin{}, - stopChannel: make(chan struct{}), - commands: make(map[string]*CommandInformation), + config: config, + Plugins: []IPlugin{}, + stopChannel: make(chan struct{}), + commands: make(map[string]*CommandInformation), + commandSettings: make(map[string]*commandSettings), } // Create a new Discord session using the provided login information. diff --git a/bot/qilbotsettings.go b/bot/qilbotsettings.go new file mode 100644 index 0000000..8f467e0 --- /dev/null +++ b/bot/qilbotsettings.go @@ -0,0 +1,7 @@ +package bot + +type commandSettings struct { + OnlyUsableOnChannelID string + OnlyUsableOnDirectMessage bool + Disabled bool +} diff --git a/bot/qilbotsettings_func.go b/bot/qilbotsettings_func.go new file mode 100644 index 0000000..7e49431 --- /dev/null +++ b/bot/qilbotsettings_func.go @@ -0,0 +1 @@ +package bot diff --git a/utilities/file.go b/utilities/file.go index 6975000..8fbfb0f 100644 --- a/utilities/file.go +++ b/utilities/file.go @@ -3,6 +3,7 @@ package utilities import ( "io/ioutil" "os" + "path/filepath" ) // DefaultPermissions Permissions for file and directory creations. @@ -22,6 +23,12 @@ func FileOrDirectoryExists(path string) (bool, error) { return true, err } +// GetCurrentFolder Returns the +func GetCurrentFolder() (string, error) { + dir, err := filepath.Abs(filepath.Dir(os.Args[0])) + return dir, err +} + // SaveToFile Saves a byte array to a path. func SaveToFile(data []byte, path string) error { return ioutil.WriteFile(path, data, DefaultPermissions)