forked from JosXa/BotListBot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
settings.py
121 lines (101 loc) · 3.47 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
import os
from typing import Optional
from decouple import Csv
import sys
from decouple import config, Csv
from datetime import timedelta
DEV = config("DEV", default=False, cast=bool)
PORT = config("PORT", default=8443, cast=int)
# region BOT CONFIGURATION
BOT_TOKEN = config("BOT_TOKEN", cast=lambda v: str(v) if v else None, default=None) or (
str(sys.argv[1]) if len(sys.argv) > 1 else None
)
LOG_DIR = config("LOG_DIR", default=os.path.dirname(os.path.abspath(__file__)))
BOT_THUMBNAIL_DIR = config(
"BOT_THUMBNAIL_DIR",
default="./bot-profile-pictures",
)
ADMINS = [
62056065, # JosXa
918962, # T3CHNO
522605269, # n9ghtLY
]
MODERATORS = [
7679610, # Fabian Pastor
278941742, # riccardo
317434635, # jfowl
691609650, # Lulzx
200344026, # the scientist
234480941, # the one and only twitface
] + ADMINS
DEVELOPER_ID = config("DEVELOPER_ID", default=62056065)
BOT_CONSIDERED_NEW = 1 # Revision difference
WORKER_COUNT = 5 if DEV else 40
TEST_BOT_NAME = "gottesgebot"
LIVE_BOT_NAME = "botlistbot"
SELF_BOT_NAME = TEST_BOT_NAME if DEV else LIVE_BOT_NAME
SELF_BOT_ID = "182355371" if DEV else "265482650"
TEST_GROUP_ID = -1001118582923 # Area 51
BOTLIST_NOTIFICATIONS_ID = -1001175567094 if DEV else -1001074366879
BOTLISTCHAT_ID = TEST_GROUP_ID if DEV else -1001067163791
BLSF_ID = TEST_GROUP_ID if DEV else -1001098339113
SELF_CHANNEL_USERNAME = "botlist_testchannel" if DEV else "botlist"
REGEX_BOT_IN_TEXT = r".*(@[a-zA-Z0-9_]{3,31}).*"
REGEX_BOT_ONLY = r"(@[a-zA-Z0-9_]{3,31})"
PAGE_SIZE_SUGGESTIONS_LIST = 5
PAGE_SIZE_BOT_APPROVAL = 5
MAX_SEARCH_RESULTS = 25
MAX_BOTS_PER_MESSAGE = 140
BOT_ACCEPTED_IDLE_TIME = 2 # minutes
SUGGESTION_LIMIT = 25
API_URL = "localhost" if DEV else "josxa.jumpingcrab.com"
API_PORT = 6060
# endregion
# region BOTCHECKER
RUN_BOTCHECKER = config("RUN_BOTCHECKER", True, cast=bool)
USE_USERBOT = RUN_BOTCHECKER
API_ID = config("API_ID", cast=lambda v: int(v) if v else None, default=None)
API_HASH = config("API_HASH", default=None)
USERBOT_SESSION = config("USERBOT_SESSION", default=None)
USERBOT_PHONE = config("USERBOT_PHONE", default=None)
PING_MESSAGES = ["/start", "/help"]
PING_INLINEQUERIES = ["", "abc", "/test"]
BOTCHECKER_CONCURRENT_COUNT = 20
BOTCHECKER_INTERVAL = 3600 * 3
DELETE_CONVERSATION_AFTER_PING = config(
"DELETE_CONVERSATIONS_AFTER_PING", True, cast=bool
)
NOTIFY_NEW_PROFILE_PICTURE = not DEV
DOWNLOAD_PROFILE_PICTURES = config("DOWNLOAD_PROFILE_PICTURES", True, cast=bool)
DISABLE_BOT_INACTIVITY_DELTA = timedelta(days=15)
OFFLINE_DETERMINERS = [
"under maintenance",
"bot turned off",
"bot parked",
"offline for maintenance",
]
BOTBUILDER_DETERMINERS = [
"use /off to pause your subscription",
"use /stop to unsubscribe",
"manybot",
"chatfuelbot",
]
FORBIDDEN_KEYWORDS = config("FORBIDDEN_KEYWORDS", cast=Csv(), default=[])
# endregion
SENTRY_URL = config("SENTRY_URL", default=None)
SENTRY_ENVIRONMENT = config("SENTRY_ENVIRONMENT", default=None)
DEBUG_LOG_FILE = "botlistbot.log"
BOTLIST_REQUESTS_CHANNEL = None
if not os.path.exists(BOT_THUMBNAIL_DIR):
os.makedirs(BOT_THUMBNAIL_DIR)
# region TESTS
BOT_UNDER_TEST = TEST_BOT_NAME if DEV else LIVE_BOT_NAME
# BOT_UNDER_TEST = LIVE_BOT_NAME
TEST_USERBOT_PHONE = config("TEST_USERBOT_PHONE", default=None)
TEST_USERBOT_SESSION = config("TEST_USERBOT_SESSION", default=None)
TEST_GROUP_ID = 1118582923
# endregion
# region FUNCTIONS
def is_sentry_enabled() -> bool:
return SENTRY_URL and SENTRY_ENVIRONMENT
# endregion