Skip to content

Commit

Permalink
Changed code from telethon to pyrogram
Browse files Browse the repository at this point in the history
  • Loading branch information
AJTimePyro committed Nov 8, 2021
1 parent fc4fb09 commit c1ffa2d
Show file tree
Hide file tree
Showing 37 changed files with 37 additions and 768 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ __pycache__/
#Test files
testexp/

#Status File
task.txt

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ RUN apt install git python3-pip -y
RUN git clone https://github.com/AJTimePyro/MegaUploaderbot
WORKDIR /MegaUploaderbot
RUN pip3 install -U -r requirements.txt
CMD python3 -m bot
CMD python3 bot.py
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
worker: python -m bot
worker: python3 bot.py
10 changes: 7 additions & 3 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
"bot",
"heroku",
"python",
"telethon",
"pyrogram",
"app.json",
"app",
"mega",
"mega.nz",
"uploader"
"uploader",
"youtube"
],
"repository" : "https://github.com/AJTimePyro/MegaUploaderbot",
"success_url" : "https://t.me/MegaDriveUploaderBot",
Expand All @@ -25,8 +26,11 @@
"API_HASH" : {
"description" : "Get From https://my.telegram.org"
},
"MONGO_CON_STRING" : {
"MONGO_STR" : {
"description" : "Get From MongoDB Atlas."
},
"OWNER_ID" : {
"description" : "Your Telegram User ID"
}
},
"stack" : "heroku-20",
Expand Down
Binary file removed betaBot/URL_Uploader.session
Binary file not shown.
8 changes: 0 additions & 8 deletions betaBot/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion betaBot/bot.py → bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
root="plugins"
)
app = Client(
"URL_Uploader",
"MegaUploader",
bot_token=Config.TG_BOT_TOKEN,
api_id=Config.APP_ID,
api_hash=Config.API_HASH,
Expand Down
7 changes: 0 additions & 7 deletions bot/__init__.py

This file was deleted.

168 changes: 0 additions & 168 deletions bot/__main__.py

This file was deleted.

16 changes: 0 additions & 16 deletions bot/botCreds.py

This file was deleted.

56 changes: 0 additions & 56 deletions bot/botMessages.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion betaBot/config.py → config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ class Config(object):

MONGO_STR = environ.get("MONGO_STR", "") # Get from MongoDB Atlas

DOWNLOAD_LOCATION = "app//DOWNLOADS//" # The download location for users. (Don't change anything in this field!)
DOWNLOAD_LOCATION = "app//DOWNLOADS//" # The download location for users. (Don't change anything in this field!)


File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
from helper.downloader.downloadingData import *


fileName = 'urlDL'


class UrlDown:

def __init__(self, bot, msg, process_msg, Downloadfolder, url):
Expand Down Expand Up @@ -59,9 +62,9 @@ async def start(self):
await self.process_msg.delete()
await self.msg.reply_text(BotMessage.unsuccessful_upload, parse_mode = 'html')
for e in downObj.get_errors():
await self.bot.send_message(OwnerID, f'In urlDL.py {line_number()} {str(e)}\n\n{self.url}')
await self.bot.send_message(OwnerID, f'{line_number(fileName, e)}\n\n{self.url}')
else:
await self.bot.send_message(OwnerID, f'In urlDL.py {line_number()}\n\n{self.url}')
await self.bot.send_message(OwnerID, f'{line_number(fileName)}\n\n{self.url}')

elif len_file == 'Not Valid':
try:
Expand Down
10 changes: 8 additions & 2 deletions betaBot/helper/downloader/ytDL.py → helper/downloader/ytDL.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

"""Importing"""
# Importing External Packages
import asyncio
from pytube import YouTube, exceptions
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup

Expand All @@ -11,6 +12,9 @@
from helper.downloader.downloadingData import *


fileName = 'ytDL'


class YTDown:

def __init__(self, bot, msg, process_msg, url, log_obj):
Expand All @@ -28,7 +32,7 @@ async def start(self):
except exceptions.VideoUnavailable:
await self.process_msg.edit_text(BotMessage.ytVideoUnavailable, parse_mode = 'html')
except Exception as e:
await self.bot.send_message(OwnerID, f'In ytDL.py {line_number()}\n{e}\n\n{self.url}')
await self.bot.send_message(OwnerID, f'{line_number(fileName, e)}\n\n{self.url}')
await self.process_msg.edit_text(BotMessage.unsuccessful_upload, parse_mode = 'html')
else:
#Creating Buttons for Selecting Quality
Expand All @@ -48,7 +52,9 @@ async def start(self):
quality_button.append(twoButton)
twoButton = []
if quality_button:
await self.process_msg.edit_text(BotMessage.choose_quality, parse_mode = 'html', reply_markup=InlineKeyboardMarkup(quality_button))
self.selectMSG = await self.process_msg.edit_text(BotMessage.choose_quality, parse_mode = 'html', reply_markup = InlineKeyboardMarkup(quality_button))
asyncio.sleep(60)
self.selectMSG.delete()
else:
await self.process_msg.edit_text(BotMessage.all_above_limit, parse_mode = 'html')
finally:
Expand Down
File renamed without changes.
Loading

0 comments on commit c1ffa2d

Please sign in to comment.