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{
Token: "TOKEN",
Timeout: 120,
ChannelID: []string{},
DefaultUserLimit: 2,
}
type configPayload struct {
......@@ -22,6 +23,7 @@ type configPayload struct {
Token string
Timeout int
ChannelID []string
DefaultUserLimit int
}
func init() {
......@@ -51,6 +53,10 @@ func parse() {
}
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
allowedChannels = make(map[string]bool)
categoryMap = make(map[string]string)
......
......@@ -78,7 +78,7 @@ func setupInstance(member *discordgo.Member) *chatInstance {
Type: discordgo.ChannelTypeGuildVoice,
Topic: "Volatile channel created by " + member.User.ID,
Bitrate: 64000,
UserLimit: 10,
UserLimit: config.DefaultUserLimit,
ParentID: parentID,
})
if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment