-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.py
177 lines (164 loc) · 7.5 KB
/
constants.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
import pytz
from default_modules.quotes import quote_module
from default_modules.reminders import reminders_module, start_remind_loop
from default_modules.roles import roles_module
from default_modules.statuses import status_loop
# main.py
DIRECTORIES = [
"databases",
# "logs",
"quotes/servers",
"quotes/resources/avatars"
]
DEFAULT_MODULES = [
quote_module,
reminders_module,
roles_module
]
DEFAULT_BACKGROUND_LOOPS = [
start_remind_loop,
status_loop
]
# akrasia.py
COMMAND_PREFIX = "!"
DEFAULT_COMMAND_COOLDOWN = 1
DEFAULT_HOOK_COOLDOWN = 1
DATABASE_DIR = "databases"
DEFAULT_RETURN_MESSAGE = None
LOG_DATETIME_FORMAT = "%Y/%M/%d %H:%M:%S"
LOGS_DIR = "logs"
MAIN_DATABASE_NAME = "main.db"
MAX_REMINDER_FAILURES = 8
REMINDER_FAILURE_DELAY_TIME = {1: 10, 2: 60, 3: 60, 4: 60, 5: 3600, 6: 3600, 7: 3600}
REMINDER_LOOP_TIME_INCREMENT = 1
PREFIX_LENGTH = 1
TEXT_HOOKS = ["akrasia,"]
HOME_SERVER_ID = None # initialized by Akrasia.run()
AUTHOR_ID = None # initialized by Akrasia.run()
MAX_ALIASES_PER_SERVER = 5000
MAX_REMINDERS_PER_USER = 100
MESSAGE_TRUNCATOR = "[truncated]"
TRUNCATED_MESSAGE_LENGTH = 2000 - len(MESSAGE_TRUNCATOR)
MAX_CHARS_PER_MESSAGE = 2000
SEND_CYCLE_WAIT_TIME = 0.5
AMBIGUOUS_ERROR = -1
QUOTES_COOLDOWN = 2
AVATAR_TEST_COOLDOWN = 5
GUILD_REQUIRED_MESSAGE = "Can't call `{}{}` in a DM (unless you set your home server using `{}setserver`)"
DEFAULT_AUDIT_LOG_ENTRIES = 5
MAX_AUDIT_LOG_ENTRIES = 100
MAGIC_8_BALL_RESPONSES = [
"Without a doubt.",
"As I see it, yes.",
"Most likely.",
"Outlook good.",
"Signs point to yes.",
"Reply hazy, try again.",
"Ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrate and ask again.",
"Don't count on it.",
"My reply is no.",
"My sources say no.",
"Outlook not so good.",
"Very doubtful."
]
CHANGE_STATUS_TIMER = 300
DEFAULT_HELP_DICT = {
"help": "Summons Cthulu directly behind you.",
"echo": "**echo** *[message]*\n"
"*echo [channel] [message]*\n"
"*Permissions required: bot instance owner*\n"
" Sends the given message to the given channel, or the current channel if no channel is given.\n"
" `!echo uncle bill gave me his water bill for my third birthday`\n"
" `!echo #general :crab: SHE TOOK THE KIDS :crab:\n",
"addalias": "**addalias** *[old command] [new keyword]*\n"
"*Permissions required: administrator*\n"
" Creates a new command that executes old command (optionally with arguments).\n"
" `!addalias echo say` => `!say They speak English in what?`\n"
" `!addalias \"echo AAAAAAAAAAUGH\" SCREAM` => `!SCREAM`\n",
"deletealias": "**deletealias** *[alias]*\n"
"*Permissions required: administrator*\n"
" Deletes an existing alias.\n"
" `!deletealias SCREAM`\n",
"aliases": "**aliases**\n"
"*Permissions required: administrator*\n"
" Lists all aliases on the current server. Be careful about running this if you've got a billion aliases.\n"
" `!aliases`\n",
"auditlog": "**auditlog** *[search term] [number of results to find]*\n"
"*auditlog [number of results to find]*\n"
"*auditlog [search term]*\n"
"*Permissions required: administrator*\n"
" Displays the most recent *n* commands run on this server that match a given search term\n"
" Search term can be any of (username, user ID, part of message)\n"
" `!auditlog addalias 10`\n"
" `!auditlog Crowfeather`",
"setserver": "**setserver** *[home server ID]*\n"
"*setserver [home server name]*\n"
"*Permissions required: none*\n"
" Sets a given server as a user's home server.\n"
" Future commands in DMs with this user will be run as if they were on the home server.\n"
" (call without a server name sets your home to the current server)\n"
" (call without a server name in DMs will reset your home server)\n"
" `!setserver Goon Platoon`"
}
# logging.py
LOG_SLEEP_TIME = {"audit": 1, "log": 0.5}
# quotes.py
DEFAULT_V_MARGIN = 8 # 2 for the actual margin, 3 for the 3 pixels of space above the text, 3 for the 3 pixels of space below the previous text
DEFAULT_LEFT_MARGIN = 16
DEFAULT_RIGHT_MARGIN = 30 # personal choice
PFP_TO_TEXT_MARGIN = 16
PFP_DIAMETER = 40
NAME_TO_TIMESTAMP_MARGIN = 8
NAME_TO_MESSAGE_MARGIN = 6
BETWEEN_LINES_MARGIN = 6 # used to be 4
BETWEEN_MESSAGES_MARGIN = 4 # used to be 6
BETWEEN_AUTHORS_MARGIN = 16 # so the total space between the text from two authors is 16 + 10 + 4 = 30 px
AUTHOR_SIZE = 16
TIMESTAMP_SIZE = 12
MESSAGE_SIZE = 16
AUTHOR_COLOR = (255, 255, 255)
TIMESTAMP_COLOR = (114, 118, 125)
MESSAGE_COLOR = (220, 221, 222)
BACKGROUND_COLOR = (54, 57, 63)
QUOTES_DIR = "quotes/servers"
PFP_MASK_PATH = "quotes/resources/pfp_mask.png"
PFPS_FOLDER_PATH = "quotes/resources/avatars"
DISCORD_BOLD_FONT = "quotes/resources/Whitney-Semibold.ttf"
DISCORD_NORMAL_FONT = "quotes/resources/Whitney-Medium.ttf"
WEEKDAY_NAMES = {0: "Monday", 1: "Tuesday", 2: "Wednesday", 3: "Thursday", 4: "Friday", 5: "Saturday", 6: "Sunday"}
TIMESTAMP_TOP_OFFSET = 5
IMAGE_WIDTH = 700
MAX_EMBED_DIMENSIONS = (400, 300)
MESSAGE_TO_EMBED_SEPERATION = 11
SUPPORTED_IMAGE_FILETYPES = ["png", "jpg", "jpeg"] # gif?
MAX_EMBED_FILESIZE = 50 * 10**6 # 50 Mb
MAX_AVATAR_FILESIZE = 5 * 10**6 # 5 Mb
SECONDS_FOR_SEPERATED_MESSAGES = 7 * 60 # 7 minutes, as best as I can tell
MAX_QUOTES_PER_SERVER = 500
MAX_REVERSE_SEARCH_MESSAGES = 250
TIMEZONE = pytz.timezone("US/Eastern")
TEXT_TO_IMAGE_MARGIN = 4
REACTION_IMG_SIZE = (16, 16)
REACTION_TEXT_SIZE = 14
REACTION_MIN_WIDTH = 43
REACTION_WIDTH_WITHOUT_NUMBER = 36
AVATAR_TEST_MESSAGES = [
"I have come here to chew bubblegum and kick ass.\nAnd I'm all out of bubblegum.",
"I have come here to chew bubblegum and kick ass.\nAnd I'm all out of ass.",
"Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.",
"Does he look like a bitch?",
"i spent five minutes on google image search and all i got was this shitty avatar",
"Yeah, twenty kilos. I'll pay in unmarked bills."
]
MAX_CONTENT_WIDTH = IMAGE_WIDTH - DEFAULT_LEFT_MARGIN - PFP_DIAMETER - PFP_TO_TEXT_MARGIN - DEFAULT_RIGHT_MARGIN # personal choice
# reminders.py
SECONDS_ALIAS = ["second", "sec", "secs", "seconds"]
MINUTES_ALIAS = ["minute", "minutes", "min", "mins"]
HOURS_ALIAS = ["hour", "hours", "hr", "hrs"]
DAYS_ALIAS = ["day", "days"]
WEEKS_ALIAS = ["week", "weeks", "wk", "wks"]
MONTHS_ALIAS = ["month", "months", "mon", "mons"]
YEARS_ALIAS = ["year", "years", "yr", "yrs"]