Skip to content
Snippets Groups Projects
Commit 5d192b35 authored by Ophestra's avatar Ophestra
Browse files

configurable default user limit

parent 189aea42
Branches
No related tags found
No related merge requests found
...@@ -15,6 +15,7 @@ var defaultConfig = configPayload{ ...@@ -15,6 +15,7 @@ var defaultConfig = configPayload{
Token: "TOKEN", Token: "TOKEN",
Timeout: 120, Timeout: 120,
ChannelID: []string{}, ChannelID: []string{},
DefaultUserLimit: 2,
} }
type configPayload struct { type configPayload struct {
...@@ -22,6 +23,7 @@ type configPayload struct { ...@@ -22,6 +23,7 @@ type configPayload struct {
Token string Token string
Timeout int Timeout int
ChannelID []string ChannelID []string
DefaultUserLimit int
} }
func init() { func init() {
...@@ -51,6 +53,10 @@ func parse() { ...@@ -51,6 +53,10 @@ func parse() {
} }
func configLate() { func configLate() {
if config.DefaultUserLimit > 99 || config.DefaultUserLimit < 1 {
log.Warnf("Value %v is out of range for default user limit.", config.DefaultUserLimit)
config.DefaultUserLimit = defaultConfig.DefaultUserLimit
}
timeout = time.Duration(config.Timeout) * time.Second timeout = time.Duration(config.Timeout) * time.Second
allowedChannels = make(map[string]bool) allowedChannels = make(map[string]bool)
categoryMap = make(map[string]string) categoryMap = make(map[string]string)
......
...@@ -78,7 +78,7 @@ func setupInstance(member *discordgo.Member) *chatInstance { ...@@ -78,7 +78,7 @@ func setupInstance(member *discordgo.Member) *chatInstance {
Type: discordgo.ChannelTypeGuildVoice, Type: discordgo.ChannelTypeGuildVoice,
Topic: "Volatile channel created by " + member.User.ID, Topic: "Volatile channel created by " + member.User.ID,
Bitrate: 64000, Bitrate: 64000,
UserLimit: 10, UserLimit: config.DefaultUserLimit,
ParentID: parentID, ParentID: parentID,
}) })
if err != nil { if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment