forked from Sachinanand99/File-Sharing-Telegram-bot
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.py
110 lines (97 loc) · 4.63 KB
/
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
from operator import add
import os
import logging
from logging.handlers import RotatingFileHandler
#add admins in the list without "" or '' and without comma
#remove predefined numbers <<just for demonstration purpose. no need to add owner.>>
#eg : ADMINS="34768 343487"
ADMINS = list(set(int(x) for x in os.environ.get("ADMINS", "").split()))
#force user to join your backup channel leave 0 if you don't need.
FORCE_SUB_CHANNEL = int(os.environ.get("FORCE_SUB_CHANNEL", "0"))
FORCE_SUB_CHANNEL2 = int(os.environ.get("FORCE_SUB_CHANNEL2", "0"))
if FORCE_SUB_CHANNEL > FORCE_SUB_CHANNEL2:
temp = FORCE_SUB_CHANNEL2
FORCE_SUB_CHANNEL2 = FORCE_SUB_CHANNEL
FORCE_SUB_CHANNEL = temp
#bot stats
BOT_STATS_TEXT = os.environ.get("BOTS_STATS_TEXT","<b>BOT UPTIME</b>\n{uptime}")
#send custom message when user interact with bot
USER_REPLY_TEXT = os.environ.get("USER_REPLY_TEXT", "❌Don't send me messages directly I'm only File Share bot!")
#your bot token here from https://telegram.me/BotFather
TG_BOT_TOKEN = os.environ.get("TG_BOT_TOKEN", "")
#your api id from https://my.telegram.org/apps
APP_ID = int(os.environ.get("APP_ID", ""))
#your api hash from https://my.telegram.org/apps
API_HASH = os.environ.get("API_HASH", "")
#your channel_id from https://t.me/MissRose_bot by forwarding dummy message to rose and applying command `/id` in reply to that message
CHANNEL_ID = int(os.environ.get("CHANNEL_ID", ""))
#your database channel link
CHANNEL_LINK = os.environ.get("CHANNEL_LINK", "")
#your id of telegram can be found by https://t.me/MissRose_bot with '/id' command
OWNER_ID = int(os.environ.get("OWNER_ID", ""))
#port set to default 8080
PORT = os.environ.get("PORT", "8080")
#your database url mongodb only You can use mongo atlas free cloud database
DB_URL = os.environ.get("DATABASE_URL")
# DB_URL = os.environ.get("DATABASE_URL", "") #for hosting locally comment above and uncomment this
#your database name
DB_NAME = os.environ.get("DATABASE_NAME", "filestorebot")
#for creating telegram thread for bot to improve performance of the bot
TG_BOT_WORKERS = int(os.environ.get("TG_BOT_WORKERS", "4"))
#your start default command message.
START_MSG = os.environ.get("START_MESSAGE", "Hello {first}\n\nI can store private files in Specified Channel and other users can access it from special link.")
#your telegram tag without @
OWNER_TAG = os.environ.get("OWNER_TAG", "")
#Time in seconds for message delete
TIME = int(os.environ.get("TIME", "60"))
#Shortner (token system)
"""
some token verification sites
https://dashboard.shareus.io/
"""
# Turn this feature on or off using True or False put value inside ""
# True for yes False if no
USE_SHORTLINK = True if os.environ.get('USE_SHORTLINK', "False") == "True" else False
# only shareus service known rightnow rest you can test on your own
SHORTLINK_URL = os.environ.get("SHORTLINK_URL", "api.shareus.io")
SHORTLINK_API = os.environ.get("SHORTLINK_API", "")
#add your custom time in secs for shortlink expiration.
# 24hr = 86400
# 12hr = 43200
VERIFY_EXPIRE = int(os.environ.get('VERIFY_EXPIRE', 86400)) # Add time in seconds
#Tutorial video for the user of your shortner on how to download.
TUT_VID = os.environ.get("TUT_VID","https://t.me/How_to_Download_7x/32")
#force message for joining the channel
FORCE_MSG = os.environ.get("FORCE_SUB_MESSAGE", "Hello {first}\n\n<b>You need to join in my Channel/Group to use me\n\nKindly Please join Channel</b>")
#custom caption
CUSTOM_CAPTION = os.environ.get("CUSTOM_CAPTION", None)
#protected content so that no files can be sent from the bot to anyone. recommended False
# True for yes False if no
PROTECT_CONTENT = True if os.environ.get('PROTECT_CONTENT', "False") == "True" else False
#used if you dont need buttons on database channel.
# True for yes False if no
DISABLE_CHANNEL_BUTTON = True if os.environ.get("DISABLE_CHANNEL_BUTTON", "True") == "True" else False
#no need to add anything from now on
try:
for x in (os.environ.get("ADMINS", "").split()):
ADMINS.append(int(x))
except ValueError:
raise Exception("Your Admins list does not contain valid integers.")
ADMINS.append(OWNER_ID)
LOG_FILE_NAME = "logs.txt"
logging.basicConfig(
level=logging.INFO,
format="[%(asctime)s - %(levelname)s] - %(name)s - %(message)s",
datefmt='%d-%b-%y %H:%M:%S',
handlers=[
RotatingFileHandler(
LOG_FILE_NAME,
maxBytes=50000000,
backupCount=10
),
logging.StreamHandler()
]
)
logging.getLogger("pyrogram").setLevel(logging.WARNING)
def LOGGER(name: str) -> logging.Logger:
return logging.getLogger(name)