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 a exception that is made if the check fails. |
26
|
|
|
|
27
|
|
|
validate |
28
|
|
|
--- |
29
|
|
|
Deals with school_list.csv: |
30
|
|
|
|
31
|
|
|
`utils.school_check` checks if the input is a valid school name. |
32
|
|
|
`utils.state_list` returns all schools in a state. |
33
|
|
|
`utils.school_search` returns a list of possible schools |
34
|
|
|
`utils.region_select` returns the region that a school is in. |
35
|
|
|
|
36
|
|
|
messages |
37
|
|
|
--- |
38
|
|
|
Deals with various messaging cases: |
39
|
|
|
|
40
|
|
|
`utils.list_messages take a list and sends it as a message |
41
|
|
|
`utils.admin_log` logs anything to the admin_channels |
42
|
|
|
`utils.make_embed` returns an initial discord.Embed |
43
|
|
|
`utils.TF_emoji` returns str for TRUE/FALSE emoji |
44
|
|
|
""" |
45
|
|
|
from .datahandler import table_create, fetch, select, insert, update, delete |
46
|
|
|
from .logger import make_logger |
47
|
|
|
from .shared import check_admin, check_react, FailedReactionCheck, TF_emoji |
48
|
|
|
from .validate import ( |
49
|
|
|
school_check, |
50
|
|
|
state_list, |
51
|
|
|
school_search, |
52
|
|
|
region_select, |
53
|
|
|
update_list, |
54
|
|
|
) |
55
|
|
|
from .messages import list_message, admin_log, make_embed, error_message |
56
|
|
|
|
57
|
|
|
__all__ = [ |
58
|
|
|
"table_create", |
59
|
|
|
"fetch", |
60
|
|
|
"select", |
61
|
|
|
"insert", |
62
|
|
|
"update", |
63
|
|
|
"delete", |
64
|
|
|
"make_logger", |
65
|
|
|
"check_admin", |
66
|
|
|
"check_react", |
67
|
|
|
"FailedReactionCheck", |
68
|
|
|
"TF_emoji", |
69
|
|
|
"school_check", |
70
|
|
|
"state_list", |
71
|
|
|
"school_search", |
72
|
|
|
"region_select", |
73
|
|
|
"update_list", |
74
|
|
|
"list_message", |
75
|
|
|
"admin_log", |
76
|
|
|
"make_embed", |
77
|
|
|
"error_message", |
78
|
|
|
] |
79
|
|
|
|