aboutsummaryrefslogtreecommitdiff
path: root/util.go
diff options
context:
space:
mode:
authorNathan Perry <avaglir@gmail.com>2017-07-27 21:54:59 -0400
committerNathan Perry <avaglir@gmail.com>2017-07-27 21:54:59 -0400
commit54359c61daadf1d61730d224675c3b4595a5b83a (patch)
tree7fdf2e0aeafa399a208a75b6ee43c1e9fe6aa066 /util.go
parentc8f28679d10b3004fb7f04f54e625284c93e0c70 (diff)
some more updates
Diffstat (limited to 'util.go')
-rw-r--r--util.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/util.go b/util.go
index bd44d8d..8e6de1e 100644
--- a/util.go
+++ b/util.go
@@ -2,12 +2,9 @@ package thulani
import (
"encoding/json"
- "os"
-
"net/url"
-
+ "os"
"strconv"
-
"sync"
"github.com/bwmarrin/discordgo"
@@ -49,7 +46,7 @@ func handle(err error) {
}
func LoadConfig(filename string) (*Config, error) {
- file, err := os.Open("config.json")
+ file, err := os.Open(filename)
if err != nil {
return nil, err
}
@@ -59,9 +56,6 @@ func LoadConfig(filename string) (*Config, error) {
return &conf, err
}
-var _oauthUrl string
-var oauthOnce sync.Once
-
const requestedPerms = discordgo.PermissionEmbedLinks |
discordgo.PermissionReadMessages |
discordgo.PermissionAddReactions |
@@ -75,6 +69,9 @@ const requestedPerms = discordgo.PermissionEmbedLinks |
discordgo.PermissionVoiceUseVAD |
discordgo.PermissionAttachFiles
+var _oauthUrl string
+var oauthOnce sync.Once
+
func oauthUrl() string {
oauthOnce.Do(func() {
oUrl, err := url.Parse("https://discordapp.com/api/oauth2/authorize")