forked from zankforza/BotHub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample_config.py
224 lines (207 loc) · 10.3 KB
/
sample_config.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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# PLEASE STOP!
# DO NOT EDIT THIS FILE
# Create a new config.py file in same dir and import, then extend this class.
import os
from telethon.tl.types import ChatBannedRights
from pymongo import MongoClient
from redis import StrictRedis
class Config(object):
LOGGER = True
# Get this value from my.telegram.org! Please do not steal
APP_ID = int(os.environ.get("APP_ID", 6))
API_HASH = os.environ.get("API_HASH", "eb06d4abfb49dc3eeb1aeb98ae0f581e")
# Photo Chat - Get this value from http://antiddos.systems
API_TOKEN = os.environ.get("API_TOKEN", "15e05de0-0357-4553-b39c-d614443ed91e")
# Get this value from https://t.me/SitiSchu! Please do not steal, group for support https://t.me/SpamWatchSupport
SPAMWATCH_API = os.environ.get("SPAMWATCH_API", "hAlogsz5yVFw4TYjIf6I993YFpZj~AT_5wCNrwnY3YeekgeEH1g62hO1hog02UHO")
# Genius lyrics get this value from https://genius.com/developers both has same values
GENIUS_API_TOKEN = os.environ.get("GENIUS", None)
# Genius lyrics get this value from https://genius.com/developers both has same values
GENIUS = os.environ.get("GENIUS_API_TOKEN", None)
# Default alive name for .on cmd
ALIVE_NAME = os.environ.get("ALIVE_NAME", None)
# Userbot logging feature switch.
BOTLOG = bool(os.environ.get("BOTLOG", "False"))
# PhotoChat - don't change this value from http://antiddos.systems
API_URL = os.environ.get("API_URL", "http://antiddos.systems")
# string session for running on Heroku
# some people upload their session files on GitHub or other third party hosting
# websites, this might prevent the un-authorized use of the
# confidential session files
HU_STRING_SESSION = os.environ.get("HU_STRING_SESSION", None)
# Get your own APPID from https://api.openweathermap.org/data/2.5/weather
OPEN_WEATHER_MAP_APPID = os.environ.get("OPEN_WEATHER_MAP_APPID", None)
# Your City
WEATHER_DEFCITY = os.environ.get("WEATHER_DEFCITY", None)
# Get your own ACCESS_KEY from http://api.screenshotlayer.com/api/capture
SCREEN_SHOT_LAYER_ACCESS_KEY = os.environ.get("SCREEN_SHOT_LAYER_ACCESS_KEY", None)
# Send .get_id in any group to fill this value.
PRIVATE_GROUP_BOT_API_ID = int(os.environ.get("PRIVATE_GROUP_BOT_API_ID", -100123456789))
# Send .get_id in any channel to fill this value. ReQuired for @Manuel15 inspiration to work!
PRIVATE_CHANNEL_BOT_API_ID = int(os.environ.get("PRIVATE_CHANNEL_BOT_API_ID", -100123456789))
# This is required for the plugins involving the file system.
TMP_DOWNLOAD_DIRECTORY = os.environ.get("TMP_DOWNLOAD_DIRECTORY", "./DOWNLOADS/")
# This is required for the speech to text module. Get your USERNAME from https://console.bluemix.net/docs/services/speech-to-text/getting-started.html
IBM_WATSON_CRED_URL = os.environ.get("IBM_WATSON_CRED_URL", None)
IBM_WATSON_CRED_PASSWORD = os.environ.get("IBM_WATSON_CRED_PASSWORD", None)
# This is required for the hash to torrent file functionality to work.
HASH_TO_TORRENT_API = os.environ.get("HASH_TO_TORRENT_API", "https://example.com/torrent/{}");
# This is required for the @telegraph functionality.
TELEGRAPH_SHORT_NAME = os.environ.get("TELEGRAPH_SHORT_NAME", "UniBorg")
# Get a Free API Key from OCR.Space
OCR_SPACE_API_KEY = os.environ.get("OCR_SPACE_API_KEY", None)
# Send .get_id in any group with all your administration bots (added)
G_BAN_LOGGER_GROUP = int(os.environ.get("G_BAN_LOGGER_GROUP", -100123456789))
# TG API limit. An album can have atmost 10 media!
TG_GLOBAL_ALBUM_LIMIT = int(os.environ.get("TG_GLOBAL_ALBUM_LIMIT", 9))
# Telegram BOT Token from @BotFather
TG_BOT_TOKEN_BF_HER = os.environ.get("TG_BOT_TOKEN_BF_HER", None)
TG_BOT_USER_NAME_BF_HER = os.environ.get("TG_BOT_USER_NAME_BF_HER", None)
#
#
# DO NOT EDIT BELOW THIS LINE IF YOU DO NOT KNOW WHAT YOU ARE DOING
# TG API limit. A message can have maximum 4096 characters!
MAX_MESSAGE_SIZE_LIMIT = 4095
# set blacklist_chats where you do not want userbot's features
UB_BLACK_LIST_CHAT = set(int(x) for x in os.environ.get("UB_BLACK_LIST_CHAT", "").split())
# maximum number of messages for antiflood
MAX_ANTI_FLOOD_MESSAGES = 10
# warn mode for anti flood
ANTI_FLOOD_WARN_MODE = ChatBannedRights(
until_date=None,
view_messages=None,
send_messages=True
)
# chat ids or usernames, it is recommended to use chat ids,
# providing usernames means an additional overhead for the user
CHATS_TO_MONITOR_FOR_ANTI_FLOOD = []
# specify LOAD and NO_LOAD
LOAD = []
# foloowing plugins won't work on Heroku,
# ⚡Remove This To Make Them Work But Would Make Bot Unstable AF...⚡
NO_LOAD = [
"left",
"autores",
"hand",
]
# Get your own API key from https://www.remove.bg/ or
# feel free to use http://telegram.dog/Remove_BGBot
REM_BG_API_KEY = os.environ.get("REM_BG_API_KEY", None)
# you can set any name here
SLAP_USERNAME = os.environ.get("SLAP_USERNAME", None)
# Get this from Github
GITHUB_ACCESS_TOKEN = os.environ.get("GITHUB_ACCESS_TOKEN", None)
GIT_REPO_NAME = os.environ.get("GIT_REPO_NAME", None)
# Set to True if you want to block users that are spamming your PMs.
NO_P_M_SPAM = bool(os.environ.get("NO_P_M_SPAM", False))
# define "spam" in PMs
MAX_FLOOD_IN_P_M_s = int(os.environ.get("MAX_FLOOD_IN_P_M_s", 3))
# set to True if you want to log PMs to your PM_LOGGR_BOT_API_ID
NC_LOG_P_M_S = bool(os.environ.get("NC_LOG_P_M_S", False))
# send .get_id in any channel to forward all your NEW PMs to this group
PM_LOGGR_BOT_API_ID = int(os.environ.get("PM_LOGGR_BOT_API_ID", "-100"))
# For Databases
# can be None in which case plugins requiring
# DataBase would not work
DB_URI = os.environ.get("DATABASE_URL", None)
# For Databases
# can be None in which case plugins requiring
# DataBase would not work
MONGO_URI = os.environ.get("MONGO_URI", None)
# number of rows of buttons to be displayed in .helpme command
NO_OF_BUTTONS_DISPLAYED_IN_H_ME_CMD = int(os.environ.get("NO_OF_BUTTONS_DISPLAYED_IN_H_ME_CMD", 5))
# specify command handler that should be used for the plugins
# this should be a valid "regex" pattern
COMMAND_HAND_LER = os.environ.get("COMMAND_HAND_LER", "\.")
# specify list of users allowed to use bot
# WARNING: be careful who you grant access to your bot.
# malicious users could do ".exec rm -rf /*"
SUDO_USERS = set(int(x) for x in os.environ.get("SUDO_USERS", "").split())
# VeryStream only supports video formats
VERY_STREAM_LOGIN = os.environ.get("VERY_STREAM_LOGIN", None)
VERY_STREAM_KEY = os.environ.get("VERY_STREAM_KEY", None)
# for temporary saving files on UserBot
TEMP_DIR = os.environ.get("TEMP_DIR", None)
# This is required for few things
CHANNEL_ID = os.environ.get("CHANNEL_ID", None)
# Google Drive ()
G_DRIVE_CLIENT_ID = os.environ.get("G_DRIVE_CLIENT_ID", None)
G_DRIVE_CLIENT_SECRET = os.environ.get("G_DRIVE_CLIENT_SECRET", None)
GDRIVE_FOLDER_ID = os.environ.get("GDRIVE_FOLDER_ID", None)
AUTH_TOKEN_DATA = os.environ.get("AUTH_TOKEN_DATA", None)
os.makedirs(TMP_DOWNLOAD_DIRECTORY, exist_ok=True)
t_file = open(TMP_DOWNLOAD_DIRECTORY+"auth_token.txt","w")
t_file.write(AUTH_TOKEN_DATA)
t_file.close()
#
TELE_GRAM_2FA_CODE = os.environ.get("TELE_GRAM_2FA_CODE", None)
#
GROUP_REG_SED_EX_BOT_S = os.environ.get("GROUP_REG_SED_EX_BOT_S", r"(regex|moku|BananaButler_|rgx|l4mR)bot")
# rapidleech plugins
# don't change the values
OPEN_LOAD_LOGIN = os.environ.get("OPEN_LOAD_LOGIN", "100")
OPEN_LOAD_KEY = os.environ.get("OPEN_LOAD_KEY", "100")
# Google Chrome Selenium Stuff
# taken from https://github.com/jaskaranSM/UniBorg/blob/9072e3580cc6c98d46f30e41edbe73ffc9d850d3/sample_config.py#L104-L106
GOOGLE_CHROME_DRIVER = os.environ.get("GOOGLE_CHROME_DRIVER", None)
GOOGLE_CHROME_BIN = os.environ.get("GOOGLE_CHROME_BIN", None)
# Chrome Driver and Headless Google Chrome Binaries
CARBON_DRIVER = os.environ.get("CARBON_DRIVER", None)
CARBON_BIN = os.environ.get("CARBON_BIN", None)
# get your value from https://Intellivoid.info
LYDIA_API = os.environ.get("LYDIA_API", None)
LYDIA_ANTI_PM = bool(os.environ.get("LYDIA_ANTI_PM", "True"))
# get your value from YouTube or Google.
YOUTUBE_API_KEY = os.environ.get("YOUTUBE_API_KEY", None)
# Heroku API_Key is found under "dashboard.heroku.com/account"
HEROKU_MEMEZ = bool(os.environ.get("HEROKU_MEMEZ", "False"))
HEROKU_API_KEY = os.environ.get("HEROKU_API_KEY", None)
HEROKU_APP_NAME = os.environ.get("HEROKU_APP_NAME", None)
# required for Carbor
CHROME_DRIVER = os.environ.get("CHROME_DRIVER", None)
CHROME_BIN = os.environ.get("CHROME_BIN", None)
# define "repo_link" in conig_vars
REPO_LINK = os.environ.get("REPO_LINK", "https://github.com/mkaraniya/BotHub.git")
# define "UPSTREAM_REPO_URL" in conig_vars
UPSTREAM_REPO_URL = os.environ.get("UPSTREAM_REPO_URL", "https://github.com/mkaraniya/BotHub.git")
# define "HEROKU_GIT_URL" | https://git.heroku.com/YOUR_HEROKU_APP_NAME.git
HEROKU_GIT_URL = os.environ.get("HEROKU_GIT_URL", "YOUR HEROKU GIT URL")
# define "heroku_link" in conig_vars
HEROKU_LINK = os.environ.get("HEROKU_LINK", "YOUR HEROKU GIT URL")
# define "packs_content" in conig_vars
PACKS_CONTENT = os.environ.get("PACKS_CONTENT", None)
#
BOT_HUB = os.environ.get("BOT_HUB", None)
#
# Init Mongo
MONGOCLIENT = MongoClient(Config.MONGO_URI, 27017, serverSelectionTimeoutMS=1)
MONGO = MONGOCLIENT.userbot
def is_mongo_alive():
try:
MONGOCLIENT.server_info()
except BaseException:
return False
return True
# Init Redis
# Redis will be hosted inside the docker container that hosts the bot
# We need redis for just caching, so we just leave it to non-persistent
REDIS = StrictRedis(host='localhost', port=6379, db=0)
def is_redis_alive():
try:
REDIS.ping()
return True
except BaseException:
return False
class Production(Config):
LOGGER = False
class Development(Config):
LOGGER = True
# Global Variables
COUNT_MSG = 0
USERS = {}
COUNT_PM = {}
LASTMSG = {}
admin_cmd = {}
USER_afkb = False
AFKBREASON = None
reason = None