forked from epicmindwarp/collapse
-
Notifications
You must be signed in to change notification settings - Fork 8
/
settings.py
183 lines (167 loc) · 10.1 KB
/
settings.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
import re
class Settings:
# is_dry_run and post_check_frequency_mins should not be overriden
# set to True to prevent any bot actions (report, remove, comments)
is_dry_run = False
post_check_frequency_mins = 5
report_submission_statement_insufficient_length = False
report_stale_unmoderated_posts = False
report_submission_statement_timeout = False
post_check_threshold_mins = 2 * 60
consecutive_old_posts = 5
stale_post_check_frequency_mins = 60
stale_post_check_threshold_mins = 12 * 60
submission_statement_pin = True
submission_statement_time_limit_mins = 30
submission_statement_minimum_char_length = 150
submission_statement_bot_prefix = "The following submission statement was provided by"
# replies to post if ss is invalid
submission_statement_final_reminder = False
# replies to ss if ss doesn't contain any keywords with "related to <response>"
submission_statement_on_topic_reminder = False
submission_statement_on_topic_keywords = []
submission_statement_on_topic_response = ""
submission_statement_on_topic_check_downvotes = False
submission_statement_on_topic_removal_score = -50000
submission_statement_on_topic_report_score = 50000
submission_statement_edit_support = False
low_effort_flair = ["casual friday", "low effort", "humor", "humour"]
ss_removal_reason = ("Your post has been removed for not including a submission statement, "
"meaning post text or a comment on your own post that provides context for the link. "
"If you still wish to share your post you must resubmit your link "
"accompanied by a submission statement of at least "
f"{str(submission_statement_minimum_char_length)} characters. "
"\n\n"
"This is a bot. Replies will not receive responses. "
"Please message the moderators if you feel this was an error.")
casual_hour_removal_reason = ("Your post has been removed because it was flaired as either "
"Casual Friday, Humor, or Low Effort and it was not posted "
"during Casual Friday. "
"\n\n"
"On-topic memes, jokes, short videos, image posts, posts requiring "
"low effort to consume, and other less substantial posts must be "
"flaired as either Casual Friday, Humor, or Low Effort, "
"and they are only allowed on Casual Fridays. "
"(That means 00:00 Friday – 08:00 Saturday UTC.) "
"\n\n"
"Clickbait, misinformation, and other similar low-quality content "
"is not allowed at any time, not even on Fridays. "
"\n\n"
"This is a bot. Replies will not receive responses. "
"Please message the moderators if you feel this was an error.")
submission_statement_rule_description = "Submission statements must clearly explain why the linked content is" \
" collapse-related. They should contain a summary or description of the" \
" content and must be at least 150 characters in length. They must be" \
" original and not overly composed of quoted text from the source. If a " \
"statement is not added within thirty minutes of posting it will be removed"
submission_statement_flair_prefixes = {
"Placeholder": "asdf",
# Add more entries for other flair types
}
def flair_pin_text(self, flair):
return self.submission_statement_flair_prefixes.get(flair, "")
def submission_statement_pin_text(self, ss, prefix):
header = f"{self.submission_statement_bot_prefix} /u/{ss.author}:\n\n---\n\n"
footer = f"\n\n---\n\n Please reply to OP's comment here: https://old.reddit.com{ss.permalink}"
return prefix + "\n\n\n" + header + ss.body + footer
class CollapseSettings(Settings):
report_stale_unmoderated_posts = True
submission_statement_final_reminder = True
submission_statement_on_topic_reminder = True
submission_statement_on_topic_keywords = ["adapt",
"bioaccumulation",
"biodiversity",
"biomass",
"boundar",
"breakdown",
"capacity",
"cascad",
"change",
"clathrate",
"climate",
"collaps",
"complex",
"consum",
"crisis",
"deplet",
"depopulation",
"disintegration",
"displac",
"economic",
"ecosystem",
"energy",
"environment",
"eroei",
"exploit",
"exponential",
"extinct",
"failure",
"feedback",
"finite",
"geoengineering",
"global",
"growth", # infinite growth, limits of growth, etc
"heuristic",
"humanity",
"industrial",
"inequal",
"irreversible",
"long now",
"ltg",
"mass starvation",
"migrat",
"nthe",
"overpopulation",
"oversho",
"peak",
"perverse incentive",
"planet",
"resilien",
"resource",
"runaway",
"scarcity",
"social",
"societ",
"supply chain",
"sustain",
"system",
"tipping point",
"uncontrolled",
"unsurvivable",
"wet bulb",
]
submission_statement_on_topic_response = "collapse"
submission_statement_on_topic_check_downvotes = True
submission_statement_on_topic_removal_score = -3
submission_statement_on_topic_report_score = 3
submission_statement_edit_support = True
submission_statement_flair_prefixes = {
"Overpopulation": "This thread addresses overpopulation, a fraught but important issue that attracts disruption"
" and rule violations. In light of this we have lower tolerance for the following offenses:"
"\n\n"
"* Racism and other forms of essentialism targeted at particular identity groups people "
"are born into."
"\n\n"
"* Bad faith attacks insisting that to notice and name overpopulation of the human "
"enterprise generally is inherently racist or fascist."
"\n\n"
"* Instructing other users to harm themselves. We have reached consensus that a permaban "
"for the first offense is an appropriate response to this, as mentioned in the sidebar."
"\n\n"
"This is an abbreviated summary of the mod team's statement on overpopulation,"
" [view the full statement available in the wiki.]"
"(https://www.reddit.com/r/collapse/wiki/claims/#wiki_mod_team_comment_on_overpopulation_posts)"
# Add more entries for other flair types
}
class SettingsFactory:
settings_classes = {
'collapse': CollapseSettings,
'ufos': Settings,
}
@staticmethod
def get_settings(subreddit_name):
# ensure only contains valid characters
if not re.match(r'^\w+$', subreddit_name):
raise ValueError("subreddit_name contains invalid characters")
settings_class = SettingsFactory.settings_classes.get(subreddit_name.lower(), Settings)
return settings_class()