-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfig.go
143 lines (126 loc) · 5.2 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
package main
import (
"fmt"
"github.com/BurntSushi/toml"
"time"
)
// Config struct
type Config struct {
DiscordConfig discordConfig `toml:"discord"`
DBConfig databaseConfig `toml:"database"`
DUBotConfig dubotConfig `toml:"du-bot"`
BankConfig bankConfig `toml:"bank"`
CasinoConfig casinoConfig `toml:"casino"`
RolesConfig rolesConfig `toml:"roles"`
APIConfig apiConfig `toml:"api"`
Recruitment recruitmentConfig `toml:"recruitment"`
Reactions ReactionsConfig `toml:"reactions"`
Rabbit RabbitConfig `toml:"rabbit"`
}
// discordConfig struct
type discordConfig struct {
Token string `toml:"bot_token"`
AdminID string `toml:"admin_id"`
GuildID string `toml:"guild_id"`
DevID string `toml:"dev_id"`
}
// databaseConfig struct
type databaseConfig struct {
DBFile string `toml:"filename"`
MongoHost string `toml:"mongohost"`
MongoDB string `toml:"mongodb"`
BackerRecordColumn string `toml:"backerrecordcolumn"`
InfoRecordColumn string `toml:"inforecordcolumn"`
MongoUser string `toml:"mongouser"`
MongoPass string `toml:"mongopass"`
}
// dubotConfig struct
type dubotConfig struct {
// Command Prefix
CP string `toml:"command_prefix"`
Playing string `toml:"default_now_playing"`
RSSTimeout time.Duration `toml:"rss_fetch_timeout"`
StatsTimeout time.Duration `toml:"stats_fetch_timeout"`
Notifications time.Duration `toml:"notifications_update_timeout"`
GiveawayTimer time.Duration `toml:"giveaway_timer"`
GiveawayChannel string `toml:"giveaway_channel"`
PerPageCount int `toml:"per_page_count"`
LuaTimeout int `toml:"lua_timeout"`
Profiler bool `toml:"enable_profiler"`
MaxAudioDuration int `toml:"max_audio_duration"`
}
// bankConfig struct
type bankConfig struct {
BankName string `toml:"bank_name"`
BankURL string `toml:"bank_url"`
BankIconURL string `toml:"bank_icon_url"`
Pin string `toml:"bank_pin"`
Reset bool `toml:"reset_bank"`
SeedWallet int `toml:"starting_bank_wallet_value"`
SeedUserAccountBalance int `toml:"starting_user_account_value"`
SeedUserWalletBalance int `toml:"starting_user_wallet_value"`
BankMenuSlogan string `toml:"bank_menu_slogan"`
}
// casinoConfig struct
type casinoConfig struct {
CasinoName string `toml:"casino_name"`
Pin string `toml:"casino_pin"`
Reset bool `toml:"reset_casino"`
SeedWallet int `toml:"starting_casino_wallet_value"`
}
// rolesConfig struct
type rolesConfig struct {
RoleTimer time.Duration `toml:"roles_timer"`
RoleUpdaterTimer time.Duration `toml:"roles_updater_timer"`
PatronRoleID string `toml:"patron_role"`
SponsorRoleID string `toml:"sponsor_role"`
ContributorRoleID string `toml:"contributor_role"`
ATVRoleID string `toml:"atv_role"`
IronRoleID string `toml:"iron_role"`
BronzeRoleID string `toml:"bronze_role"`
SilverRoleID string `toml:"silver_role"`
GoldRoleID string `toml:"gold_role"`
SapphireRoleID string `toml:"sapphire_role"`
RubyRoleID string `toml:"ruby_role"`
EmeraldRoleID string `toml:"emerald_role"`
DiamondRoleID string `toml:"diamond_role"`
KyriumRoleID string `toml:"kyrium_role"`
ForumLinkedRoleID string `toml:"forumlinked_role"`
ATVForumLinkedRoleID string `toml:"atvforumlinked_role"`
PreAlphaForumLinkedRole string `toml:"prealpha_role"`
KickstarterRole string `toml:"kickstarter_role"`
AlphaAuthorizedRole string `toml:"alpha_role"`
NDAChannelID string `toml:"nda_channel_id"`
}
type apiConfig struct {
Strawpoll string `toml:"strawpoll_api"`
WordnikKey string `toml:"wordnick_key"`
OpenWeatherKey string `toml:"openweather_key"`
}
type recruitmentConfig struct {
RecruitmentChannel string `toml:"recruitment_channel"`
RecruitmentTimeout time.Duration `toml:"recruitment_timeout"`
RecruitmentExpiration time.Duration `toml:"recruitment_expiration_timeout"`
RecruitmentReminder time.Duration `toml:"recruitment_reminder_timeout"`
RecruitmentShuffleCount int `toml:"recruitment_shuffle_count"`
RecruitmentWaitOnStartup bool `toml:"recruitment_wait_on_startup"`
}
type ReactionsConfig struct {
ReactionsExpiration time.Duration `toml:"reactions_timeout"`
InfoReactionsExpiration time.Duration `toml:"info_reactions_timeout"`
}
type RabbitConfig struct {
RabbitRandomWeight int `toml:"rabbit_random"`
RabbitCount int `toml:"rabbit_count"`
RabbitTimer time.Duration `toml:"rabbit_timer"`
RabbitExpiration time.Duration `toml:"rabbit_expiration"`
}
// ReadConfig function
func ReadConfig(path string) (config Config, err error) {
var conf Config
if _, err := toml.DecodeFile(path, &conf); err != nil {
fmt.Println(err)
return conf, err
}
return conf, nil
}