1
|
|
|
"""utility features and functions |
2
|
|
|
--- |
3
|
|
|
|
4
|
|
|
datahandler |
5
|
|
|
--- |
6
|
|
|
Deals with the database management: |
7
|
|
|
`utils.create` makes default tables. |
8
|
|
|
`utils.fetch` fetches a query from the table selected. |
9
|
|
|
`utils.select` fetches one row based on the selector values |
10
|
|
|
`utils.insert` adds a row the databases. |
11
|
|
|
`utils.update` updates a row. |
12
|
|
|
`utils.delete` deletes a row. |
13
|
|
|
|
14
|
|
|
logger |
15
|
|
|
--- |
16
|
|
|
makes the logger: |
17
|
|
|
`utils.make_logger` creates logger that outputs to a file and stream. |
18
|
|
|
|
19
|
|
|
shared: |
20
|
|
|
--- |
21
|
|
|
Various checks that are used by cogs: |
22
|
|
|
|
23
|
|
|
`utils.check_admin` checks to see if the member id is in the bot_admin table. |
24
|
|
|
`utils.check_react` checks to see if the correct reaction was added by the correct member. |
25
|
|
|
`utils.FailedReactionCheck` is an exception that is made if the check fails. |
26
|
|
|
`utils.TF_emoji` returns str for TRUE/FALSE emoji |
27
|
|
|
|
28
|
|
|
validate |
29
|
|
|
--- |
30
|
|
|
Deals with school_list.csv: |
31
|
|
|
|
32
|
|
|
`utils.school_check` checks if the input is a valid school name. |
33
|
|
|
`utils.state_list` returns all schools in a state. |
34
|
|
|
`utils.school_search` returns a list of possible schools |
35
|
|
|
`utils.region_select` returns the region that a school is in. |
36
|
|
|
|
37
|
|
|
messages |
38
|
|
|
--- |
39
|
|
|
Deals with various messaging cases: |
40
|
|
|
|
41
|
|
|
`utils.admin_log` logs anything to the admin_channels |
42
|
|
|
|
43
|
|
|
""" |
44
|
|
|
from .datahandler import fetch, select, insert, update, delete |
45
|
|
|
from .logger import make_logger |
46
|
|
|
from .shared import check_admin, check_react, FailedReactionCheck, TF_emoji |
47
|
|
|
from .validate import ( |
48
|
|
|
school_check, |
49
|
|
|
state_list, |
50
|
|
|
school_search, |
51
|
|
|
region_select, |
52
|
|
|
update_list, |
53
|
|
|
) |
54
|
|
|
|
55
|
|
|
from .messages import admin_log |
56
|
|
|
|
57
|
|
|
__all__ = [ |
58
|
|
|
"fetch", |
59
|
|
|
"select", |
60
|
|
|
"insert", |
61
|
|
|
"update", |
62
|
|
|
"delete", |
63
|
|
|
"make_logger", |
64
|
|
|
"check_admin", |
65
|
|
|
"check_react", |
66
|
|
|
"FailedReactionCheck", |
67
|
|
|
"TF_emoji", |
68
|
|
|
"school_check", |
69
|
|
|
"state_list", |
70
|
|
|
"school_search", |
71
|
|
|
"region_select", |
72
|
|
|
"update_list", |
73
|
|
|
"admin_log", |
74
|
|
|
] |
75
|
|
|
|