-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathconfig.py
250 lines (216 loc) · 7.24 KB
/
config.py
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# Copyright (C) idoneam (2016-2023)
#
# This file is part of Canary
#
# Canary is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Canary is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Canary. If not, see <https://www.gnu.org/licenses/>.
from pathlib import Path
from pydantic import BaseModel, BaseSettings
from typing import Literal
__all__ = [
"CurrencyModel",
"MusicModel",
"Config",
]
class CurrencyModel(BaseModel):
name: str = "cheeps"
symbol: str = "ʧ"
precision: int = 2
initial: int = 1000
bet_roll_cases: tuple[int, ...] = (66, 90, 99, 100) # d100 roll threshold
bet_roll_returns: tuple[int, ...] = (0, 2, 4, 10) # multiplication factorys
# Unused old ideas laid to rest below
# "salary_base": decimal.Decimal(config["Currency"]["SalaryBase"]),
# "inflation": decimal.Decimal(config["Currency"]["Inflation"]),
# "income_tax": {decimal.Decimal(b): float(a) for b, a in income_tb},
# "asset_tax": {decimal.Decimal(b): float(a) for b, a in asset_tb},
# "transaction_tax": float(config["OtherTax"]["TransactionTax"]),
class MusicModel(BaseModel):
ban_role: str = "tone deaf"
start_vol: float = 100.0
class ImagesModel(BaseModel):
max_image_size: int = 8000000
image_history_limit: int = 50
max_radius: int = 500
max_iterations: int = 20
class GamesModel(BaseModel):
hm_norm_win: int = 10
hm_cool_win: int = 20
hm_timeout: int = 600
class RolesModel(BaseModel):
pronouns: tuple[str, ...] = ("She/Her", "He/Him", "They/Them")
fields: tuple[str, ...] = (
"Accounting",
"Agriculture",
"Anatomy and Cell Biology",
"Anthropology",
"Architecture",
"Biochemistry",
"Bioengineering",
"Biology",
"Bioresource Engineering",
"Chemical Engineering",
"Chemistry",
"Civil Engineering",
"Classics",
"cogito",
"Commerce",
"Computer Engineering",
"Computer Science",
"Computer Science/Biology",
"Cultural Studies",
"Desautels",
"Economics",
"Electrical Engineering",
"English",
"Experimental Medicine",
"Finance",
"Geography",
"History",
"Human Genetics",
"Indigenous Studies",
"International Development Studies",
"Jewish Studies",
"linguini",
"mac kid",
"Materials Engineering",
"Math",
"MBA",
"Mechanical Engineering",
"Medicine",
"Microbiology and Immunology",
"Neuroscience",
"Nursing",
"Pharmacology",
"Philosophy",
"Physical Therapy",
"Physics",
"Physiology",
"Political Science",
"Psychiatry",
"Psychology",
"Public Health",
"Social Work",
"Sociology",
"Software Engineering",
"Statistics",
"Theology",
"Urban Systems",
)
faculties: tuple[str, ...] = (
"Science",
"Engineering",
"Management",
"art you glad you're not in arts",
"ArtSci",
"Agriculture and Environment",
"Continuing Studies",
"Law",
"Education",
"Dentistry",
"Music",
)
years: tuple[str, ...] = ("U0", "U1", "U2", "U3", "U4", "grad student", "workhere", "wenthere")
generics: tuple[str, ...] = (
"weeb",
"weeb stomper",
"crosswords",
"stm_alertee",
"Stardew",
"R6",
"CS:GO Popflash",
"CS:GO Comp",
"Minecraft",
"Among Us",
"Pokemon Go",
"Secret Crabbo",
"Warzone",
"Monster Hunter",
"undersad",
)
class Config(BaseSettings):
# Logging
log_level: Literal["critical", "error", "warning", "info", "debug", "notset"] = "info"
log_file: Path = Path.cwd() / "canary.log"
dev_log_webhook_id: int | None = None
dev_log_webhook_token: str | None = None
mod_log_webhook_id: int | None = None
mod_log_webhook_token: str | None = None
# Discord token
discord_key: str
# Server configs
server_id: int
command_prefix: str = "?"
bot_name: str = "Marty"
# Emoji
upvote_emoji: str = "upmartlet"
downvote_emoji: str = "downmartlet"
banner_vote_emoji: str = "redchiken"
# Roles
moderator_role: str = "Discord Moderator"
developer_role: str = "idoneam"
mcgillian_role: str = "McGillian"
honorary_mcgillian_role: str = "Honorary McGillian"
banner_reminders_role: str = "Banner Submissions"
banner_winner_role: str = "Banner of the Week Winner"
trash_tier_banner_role: str = "Trash Tier Banner Submissions"
no_food_spotting_role: str = "Trash Tier Foodspotting"
muted_role: str = "Muted"
crabbo_role: str = "Secret Crabbo"
# Channels
reception_channel: str = "martys_dm"
banner_of_the_week_channel: str = "banner_of_the_week"
banner_submissions_channel: str = "banner_submissions"
banner_converted_channel: str = "converted_banner_submissions"
food_spotting_channel: str = "foodspotting"
metro_status_channel: str = "stm_alerts"
bots_channel: str = "bots"
verification_channel: str = "verification_log"
appeals_log_channel: str = "appeals_log"
appeals_category: str = "appeals"
# Meta
repository: str = "https://github.com/idoneam/Canary.git"
# Welcome + Farewell messages
# NOT PORTED FROM OLD CONFIG SETUP.
# self.welcome = config["Greetings"]["Welcome"].split("\n")
# self.goodbye = config["Greetings"]["Goodbye"].split("\n")
# DB configuration
db_path: str = "./data/runtime/Martlet.db"
# Helpers configuration
course_year_range: str = "2024-2025"
course_tpl: str = "http://www.mcgill.ca/study/{course_year_range}/courses/{course}"
course_search_tpl: str = (
"http://www.mcgill.ca/study/{course_year_range}/courses/search?search_api_views_fulltext={search}"
"&sort_by=field_subject_code"
"&page={page}"
)
gc_weather_url: str = "https://dd.weather.gc.ca/citypage_weather/xml/QC/s0000635_e.xml"
gc_weather_alert_url: str = "https://weather.gc.ca/warnings/report_e.html?qc67"
tepid_url: str = "https://tepid.science.mcgill.ca:8443/tepid/screensaver/queues/status"
# Subscription configuration
recall_channel: str = "food"
recall_filter: str = "Quebec|National"
# Currency configuration
currency: CurrencyModel = CurrencyModel()
# Music configuration
music: MusicModel = MusicModel()
# Images configuration
images: ImagesModel = ImagesModel()
# Games configuration
games: GamesModel = GamesModel()
# Assignable Roles
roles: RolesModel = RolesModel()
class Config: # Pydantic config for our own Config class
env_file = ".env"
env_prefix = "CANARY_"
env_nested_delimiter = "__"