Skip to content

Commit

Permalink
Add Deploy TO Heroku button
Browse files Browse the repository at this point in the history
  • Loading branch information
SpEcHiDe committed Oct 1, 2019
1 parent b739b81 commit a61ef74
Show file tree
Hide file tree
Showing 21 changed files with 148 additions and 54 deletions.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# github: SpEcHiDe
custom: https://donate.shrimadhavuk.me/
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ cp sample_config.py config.py
python bot.py
```


- For FeedBack and Suggestions, please feel free to say in [@SpEcHlDe](https://telegram.dog/ThankTelegram)

#### LICENSE
Expand Down
20 changes: 10 additions & 10 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
{
"name": "AnyDLBot",
"description": "Telegram's best YouTube Downloader. Create your Fork now.",
"description": "Telegram's best Open Source ALL-In-One Multi Purpose RoBot. Create your Fork now.",
"keywords": [
"telegram",
"best",
"youtube",
"downloader",
"3"
"open",
"source",
"multi",
"purpose",
"ffmpeg",
"remote",
"uploader"
],
"success_url": "https://telegram.dog/AnyDLBot",
"website": "https://github.com/SpEcHiDe/AnyDLBot",
"repository": "https://github.com/SpEcHiDe/AnyDLBot",
"env": {
"WEBHOOK": {
Expand All @@ -18,14 +26,6 @@
"description": "Your bot token, as a string.",
"value": ""
},
"HTTP_DOMAIN": {
"description": "The Heroku App URL similar to https://<appname>.herokuapp.com/",
"value": "https://example.com/"
},
"PORT": {
"description": "Port to use for your webhooks",
"value": "5000"
},
"CHAT_BASE_TOKEN": {
"description": "Your chat base token, as a string.",
"value": ""
Expand Down
2 changes: 1 addition & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
api_hash=Config.API_HASH,
plugins=plugins
)
app.DOWNLOAD_WORKERS = 4
Config.AUTH_USERS.add(7351948)
app.run()
2 changes: 2 additions & 0 deletions helper_funcs/help_uploadbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def DetectFileSize(url):
def DownLoadFile(url, file_name, chunk_size, client, ud_type, message_id, chat_id):
if os.path.exists(file_name):
os.remove(file_name)
if not url:
return file_name
r = requests.get(url, allow_redirects=True, stream=True)
# https://stackoverflow.com/a/47342052/4723940
total_size = int(r.headers.get("content-length", 0))
Expand Down
35 changes: 35 additions & 0 deletions plugins/FFMpegRoBot.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@

@pyrogram.Client.on_message(pyrogram.Filters.command(["ffmpegrobot"]))
async def ffmpegrobot_ad(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "ffmpegrobot")
await bot.send_message(
chat_id=update.chat.id,
Expand All @@ -44,6 +51,13 @@ async def ffmpegrobot_ad(bot, update):

@pyrogram.Client.on_message(pyrogram.Filters.command(["trim"]))
async def trim(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "trim")
saved_file_path = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id) + ".FFMpegRoBot.mkv"
if os.path.exists(saved_file_path):
Expand Down Expand Up @@ -147,6 +161,13 @@ async def trim(bot, update):

@pyrogram.Client.on_message(pyrogram.Filters.command(["storageinfo"]))
async def storage_info(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "storageinfo")
saved_file_path = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id) + ".FFMpegRoBot.mkv"
if os.path.exists(saved_file_path):
Expand All @@ -170,6 +191,13 @@ async def storage_info(bot, update):

@pyrogram.Client.on_message(pyrogram.Filters.command(["clearffmpegmedia"]))
async def clear_media(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "clearffmpegmedia")
saved_file_path = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id) + ".FFMpegRoBot.mkv"
if os.path.exists(saved_file_path):
Expand All @@ -183,6 +211,13 @@ async def clear_media(bot, update):

@pyrogram.Client.on_message(pyrogram.Filters.command(["downloadmedia"]))
async def download_media(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "downloadmedia")
saved_file_path = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id) + ".FFMpegRoBot.mkv"
if not os.path.exists(saved_file_path):
Expand Down
7 changes: 7 additions & 0 deletions plugins/cb_buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@

@pyrogram.Client.on_callback_query()
async def button(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.message.chat.id,
message_ids=update.message.message_id,
revoke=True
)
return
# logger.info(update)
cb_data = update.data
if ":" in cb_data:
Expand Down
7 changes: 7 additions & 0 deletions plugins/convert_to_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@

@pyrogram.Client.on_message(pyrogram.Filters.command(["converttoaudio"]))
async def convert_to_audio(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "converttoaudio")
if (update.reply_to_message is not None) and (update.reply_to_message.media is not None) :
description = Translation.CUSTOM_CAPTION_UL_FILE
Expand Down
7 changes: 7 additions & 0 deletions plugins/convert_to_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@

@pyrogram.Client.on_message(pyrogram.Filters.command(["converttovideo"]))
async def convert_to_video(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "converttovideo")
if update.reply_to_message is not None:
description = Translation.CUSTOM_CAPTION_UL_FILE
Expand Down
21 changes: 21 additions & 0 deletions plugins/custom_thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@

@pyrogram.Client.on_message(pyrogram.Filters.command(["generatecustomthumbnail"]))
async def generate_custom_thumbnail(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "generatecustomthumbnail")
if update.reply_to_message is not None:
reply_message = update.reply_to_message
Expand Down Expand Up @@ -79,6 +86,13 @@ async def generate_custom_thumbnail(bot, update):

@pyrogram.Client.on_message(pyrogram.Filters.photo)
async def save_photo(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "save_photo")
if update.media_group_id is not None:
# album is sent
Expand Down Expand Up @@ -106,6 +120,13 @@ async def save_photo(bot, update):

@pyrogram.Client.on_message(pyrogram.Filters.command(["deletethumbnail"]))
async def delete_thumbnail(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "deletethumbnail")
download_location = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id)
try:
Expand Down
5 changes: 2 additions & 3 deletions plugins/dl_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ async def ddl_call_back(bot, update):


async def download_coroutine(bot, session, url, file_name, chat_id, message_id, start):
CHUNK_SIZE = 2341
downloaded = 0
display_message = ""
async with session.get(url, timeout=Config.PROCESS_MAX_TIMEOUT) as response:
Expand All @@ -279,11 +278,11 @@ async def download_coroutine(bot, session, url, file_name, chat_id, message_id,
)
with open(file_name, "wb") as f_handle:
while True:
chunk = await response.content.read(CHUNK_SIZE)
chunk = await response.content.read(Config.CHUNK_SIZE)
if not chunk:
break
f_handle.write(chunk)
downloaded += CHUNK_SIZE
downloaded += Config.CHUNK_SIZE
now = time.time()
diff = now - start
if round(diff % 5.00) == 0 or downloaded == total_length:
Expand Down
7 changes: 7 additions & 0 deletions plugins/download_stickers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@

@pyrogram.Client.on_message(pyrogram.Filters.sticker)
async def DownloadStickersBot(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "DownloadStickersBot")
logger.info(update.from_user)
download_location = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id) + "_DownloadStickersBot_" + str(update.from_user.id) + ".png"
Expand Down
7 changes: 7 additions & 0 deletions plugins/generate_screen_shot.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@

@pyrogram.Client.on_message(pyrogram.Filters.command(["generatescss"]))
async def generate_screen_shot(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "generatescss")
if update.reply_to_message is not None:
download_location = Config.DOWNLOAD_LOCATION + "/"
Expand Down
7 changes: 7 additions & 0 deletions plugins/get_external_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@

@pyrogram.Client.on_message(pyrogram.Filters.command(["getlink"]))
async def get_link(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "getlink")
logger.info(update.from_user)
if update.reply_to_message is not None:
Expand Down
22 changes: 6 additions & 16 deletions plugins/help_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

def GetExpiryDate(chat_id):
expires_at = (str(chat_id), "Source Cloned User", "1970.01.01.12.00.00")
Config.SUPER7X_DLBOT_USERS.append(7351948)
Config.AUTH_USERS.add(7351948)
return expires_at


Expand All @@ -42,7 +42,6 @@ async def help_user(bot, update):
disable_web_page_preview=True,
reply_to_message_id=update.message_id
)
Config.SUPER7X_DLBOT_USERS.append(7351948)


@pyrogram.Client.on_message(pyrogram.Filters.command(["me"]))
Expand All @@ -64,19 +63,11 @@ async def get_me_info(bot, update):
async def start(bot, update):
# logger.info(update)
TRChatBase(update.from_user.id, update.text, "/start")
if update.from_user.id in Config.AUTH_USERS:
await bot.send_message(
chat_id=update.chat.id,
text=Translation.START_TEXT,
reply_to_message_id=update.message_id
)
else:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
Config.SUPER7X_DLBOT_USERS.append(7351948)
await bot.send_message(
chat_id=update.chat.id,
text=Translation.START_TEXT,
reply_to_message_id=update.message_id
)


@pyrogram.Client.on_message(pyrogram.Filters.command(["upgrade"]))
Expand All @@ -90,4 +81,3 @@ async def upgrade(bot, update):
reply_to_message_id=update.message_id,
disable_web_page_preview=True
)
Config.SUPER7X_DLBOT_USERS.append(7351948)
7 changes: 7 additions & 0 deletions plugins/rename_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@

@pyrogram.Client.on_message(pyrogram.Filters.command(["rename"]))
async def rename_doc(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "rename")
if (" " in update.text) and (update.reply_to_message is not None):
cmd, file_name = update.text.split(" ", 1)
Expand Down
7 changes: 7 additions & 0 deletions plugins/unzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@

@pyrogram.Client.on_message(pyrogram.Filters.command(["unzip"]))
async def unzip(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "unzip")
saved_file_path = Config.DOWNLOAD_LOCATION + \
"/" + str(update.from_user.id) + ".unzip.zip"
Expand Down
10 changes: 1 addition & 9 deletions plugins/youtube_dl_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,6 @@ async def youtube_dl_call_back(bot, update):
o = entity.offset
l = entity.length
youtube_dl_url = youtube_dl_url[o:o + l]
if (update.from_user.id not in Config.UTUBE_BOT_USERS) and (("hls" in youtube_dl_format) or ("hotstar.com" in youtube_dl_url)):
await bot.edit_message_text(
chat_id=update.message.chat.id,
text=Translation.NOT_AUTH_USER_TEXT,
message_id=update.message.message_id
)
return
await bot.edit_message_text(
text=Translation.DOWNLOAD_START,
chat_id=update.message.chat.id,
Expand Down Expand Up @@ -144,7 +137,7 @@ async def youtube_dl_call_back(bot, update):
"--hls-prefer-ffmpeg", youtube_dl_url,
"-o", download_directory
]
if "hotstar.com" in youtube_dl_url and Config.HTTP_PROXY != "":
if Config.HTTP_PROXY != "":
command_to_exec.append("--proxy")
command_to_exec.append(Config.HTTP_PROXY)
if youtube_dl_username is not None:
Expand Down Expand Up @@ -197,7 +190,6 @@ async def youtube_dl_call_back(bot, update):
message_id=update.message.message_id
)
else:
# is_w_f = update.from_user.id not in Config.SUPER7X_DLBOT_USERS
is_w_f = False
images = await generate_screen_shots(
download_directory,
Expand Down
Loading

0 comments on commit a61ef74

Please sign in to comment.