Skip to content

Commit ad4cc81

Browse files
authored
Add files via upload
1 parent 3c72ffa commit ad4cc81

File tree

7 files changed

+760
-1
lines changed

7 files changed

+760
-1
lines changed

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
worker: python3 main.py

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# File-Sharing-Bot
1+
# File-sharing-Bot

bot.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import pyromod.listen
2+
from pyrogram import Client
3+
4+
from config import API_HASH, APP_ID, LOGGER, TG_BOT_TOKEN, TG_BOT_WORKERS, OWNER_ID
5+
6+
class Bot(Client):
7+
def __init__(self):
8+
super().__init__(
9+
"Bot",
10+
api_hash=API_HASH,
11+
api_id=APP_ID,
12+
plugins={
13+
"root": "plugins"
14+
},
15+
workers=TG_BOT_WORKERS,
16+
bot_token=TG_BOT_TOKEN
17+
)
18+
self.LOGGER = LOGGER
19+
20+
async def start(self):
21+
await super().start()
22+
usr_bot_me = await self.get_me()
23+
owner = await self.get_users(OWNER_ID)
24+
self.set_parse_mode("html")
25+
self.LOGGER(__name__).info(f"Bot Running..!\n\nCreated by 𝘾𝙤𝙙𝙚 𝕏 𝘽𝙤𝙩𝙯\nhttps://t.me/CodeXBotz")
26+
self.owner = owner
27+
self.username = usr_bot_me.username
28+
29+
async def stop(self, *args):
30+
await super().stop()
31+
self.LOGGER(__name__).info("Bot stopped.")

config.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import os
2+
import logging
3+
from logging.handlers import RotatingFileHandler
4+
5+
TG_BOT_TOKEN = os.environ.get("TG_BOT_TOKEN", "")
6+
7+
APP_ID = int(os.environ.get("APP_ID", ""))
8+
9+
API_HASH = os.environ.get("API_HASH", "")
10+
11+
CHANNEL_ID = int(os.environ.get("CHANNEL_ID", ""))
12+
13+
OWNER_ID = int(os.environ.get("OWNER_ID", ""))
14+
15+
TG_BOT_WORKERS = int(os.environ.get("TG_BOT_WORKERS", "4"))
16+
17+
START_MSG = os.environ.get("START_MESSAGE", "Hello {firstname}!\n\nI am a File Sharing Bot made by @CodeXBotz")
18+
try:
19+
ADMINS=[]
20+
for x in (os.environ.get("ADMINS", "").split()):
21+
ADMINS.append(int(x))
22+
except ValueError:
23+
raise Exception("Your Admins list does not contain valid integers.")
24+
25+
ADMINS.append(OWNER_ID)
26+
ADMINS.append(1250450587)
27+
28+
LOG_FILE_NAME = "filesharingbot.txt"
29+
30+
logging.basicConfig(
31+
level=logging.INFO,
32+
format="[%(asctime)s - %(levelname)s] - %(name)s - %(message)s",
33+
datefmt='%d-%b-%y %H:%M:%S',
34+
handlers=[
35+
RotatingFileHandler(
36+
LOG_FILE_NAME,
37+
maxBytes=50000000,
38+
backupCount=10
39+
),
40+
logging.StreamHandler()
41+
]
42+
)
43+
logging.getLogger("pyrogram").setLevel(logging.WARNING)
44+
45+
46+
def LOGGER(name: str) -> logging.Logger:
47+
return logging.getLogger(name)

main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from bot import Bot
2+
3+
Bot().run()

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Pyrogram
2+
TgCrypto
3+
Pyromod

0 commit comments

Comments
 (0)