-
-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathbot.py
More file actions
59 lines (48 loc) · 1.27 KB
/
bot.py
File metadata and controls
59 lines (48 loc) · 1.27 KB
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
#!/usr/bin/env python3
### Importing
# Importing External Packages
from pyrogram import Client
# Importing Inbuilt Packages
import logging
import os
# Importing Credentials & Required Data
try:
from testexp.config import Config
except ModuleNotFoundError:
from config import Config
### For Displaying Errors&Warnings Better
logging.basicConfig(
level = logging.INFO,
format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers = [
logging.FileHandler("megauploader.log"),
logging.StreamHandler()
]
)
logger = logging.getLogger(__name__)
logging.getLogger(
"pyrogram"
).setLevel(
logging.WARNING
)
### Starting Bot
if __name__ == "__main__" :
# Creating download directories, if they does not exists
if not os.path.isdir(Config.DOWNLOAD_LOCATION):
print("Creating 'DOWNLOADS' Directory")
os.makedirs(Config.DOWNLOAD_LOCATION)
# Connecting to Bot
print("Connecting to Bot")
app = Client(
"MegaUploader",
bot_token = Config.TG_BOT_TOKEN,
api_id = Config.APP_ID,
api_hash = Config.API_HASH,
plugins = dict(
root="plugins"
)
)
print("Connection Establised")
# Running The Bot
print("Running Bot Now!!!")
app.run()