Skip to content

Commit

Permalink
updated messages
Browse files Browse the repository at this point in the history
  • Loading branch information
AJTimePyro committed Jan 1, 2022
1 parent e926e7f commit b170deb
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 36 deletions.
17 changes: 14 additions & 3 deletions botModule/botHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
mongoSTR = Config.MONGO_STR


### Global Variable
common_text = '\n\n<b><u>If you are facing any problem😫, so report📝 at @AJPyroVerseGroup</u></b>'
to_login = '<b>If you are not logged in then, send login detail in this format email,password.</b>\n'


### Connecting To Database
mongo_client = MongoClient(mongoSTR)
db_login_detail = mongo_client['MegaUploader']
Expand All @@ -46,11 +51,14 @@ async def search_user_in_community(
msg.chat.id
)
if "kicked" in (userGroup.status, userChannel.status):
await msg.reply_text("BotMessage.userBanned", parse_mode = 'html')
await msg.reply_text(
"<b>You are Banned🚫 from AJPyroVerse Community.\nContact @AJTimePyro (Owner of AJPyroVerse)</b>",
parse_mode = 'html'
)
return
except UserNotParticipant:
await msg.reply_text(
"BotMessage.not_joined_community",
f"<b>To use this bot, you need to Join our channel and Group😁🤪.</b>{common_text}",
parse_mode = 'html',
reply_markup = InlineKeyboardMarkup(
[
Expand Down Expand Up @@ -93,7 +101,10 @@ def loginInstance(email, password, bot):
print(e.message)
return tmpCode
except Exception as e:
bot.send_message(Config.OWNER_ID, f"{e}")
bot.send_message(
Config.OWNER_ID,
f"Something went Wrong While Login account.\n{e}"
)
return None
else:
return mlog
Expand Down
7 changes: 5 additions & 2 deletions plugins/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ async def logHandler(bot:Update, msg:Message):
try:
await msg.reply_document('megauploader.log')
except Exception as e:
print(e)
await msg.reply_text(
f"Something went wrong while sending log file.\n{e}",
parse_mode = 'html'
)


### Broadcast Handler
Expand All @@ -26,7 +29,7 @@ async def broadcast_handler(bot:Update, msg:Message):
parse_mode = 'html'
)
m = await msg.reply_text(
"<>codeBroadcasting..</code>",
"<code>Broadcasting..</code>",
parse_mode = 'html'
)
SUCE = 0
Expand Down
4 changes: 2 additions & 2 deletions plugins/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ async def start_help_handler(
):
if await search_user_in_community(bot, msg):
if msg.text == "/start":
textMsg = "<b>Hi, I am MegaUploaderBot🤖 Created by @AJPyroVerse and My Developer🧑‍💻 is @AJTimePyro.</b>\n\nAnd I support:-\n1. <u>Direct Downloading Link</u>\n2.<u>Telegram File</u>\n3. <u>Youtube URL</u>\n\n\n{to_login}\n😊We will store your login detail on our database.{common_text}"
textMsg = f"<b>Hi, I am MegaUploaderBot🤖 Created by @AJPyroVerse and My Developer🧑‍💻 is @AJTimePyro.</b>\n\nAnd I support:-\n1. <u>Direct Downloading Link</u>\n2.<u>Telegram File</u>\n3. <u>Youtube URL</u>\n\n\n{to_login}\n😊We will store your login detail on our database.{common_text}"
else:
textMsg = "{to_login}\n<b>After login😊 send Direct Downloading Link, Youtube URL or any Telegram File.\n\nTo remove your account from Database use /revoke.</b>{common_text}"
textMsg = f"{to_login}\n<b>After login😊 send Direct Downloading Link, Youtube URL or any Telegram File.\n\nTo remove your account from Database use /revoke.</b>{common_text}"
await msg.reply_text(
textMsg,
parse_mode = "html"
Expand Down
20 changes: 13 additions & 7 deletions plugins/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,30 @@ async def start_handler(bot:Update, msg:Message):
email = email.strip() #Removing Whitespaces
password = password.strip() #Removing Whitespaces

log_msg = await msg.reply_text("BotMessage.trying_to_login", parse_mode = 'html')
log_msg = await msg.reply_text(
"<code>I am trying to login your account.\nSo Please Wait...</code>",
parse_mode = 'html'
)

# Trying to login
mlog = loginInstance(email, password, bot)

# Unable to login
if isinstance(mlog, int):
if mlog == -2:
nmsg = "Email or Password is incorrect."
nmsg = f"<b>Email or Password is incorrect login detail.</b>{common_text}"
elif mlog == -9:
nmsg = "Email or Password is invalid"
nmsg = f"<b>Please provide a 😒valid login detail.</b>{common_text}"
else:
nmsg = "Email or Password is invalid"
nmsg = f"<b>Please provide a 😒valid login detail.</b>{common_text}"

# Something went wrong
elif not mlog:
nmsg = "Something Went Wrong."
nmsg = f"<b>Something Went Wrong.</b>{common_text}"

# Successfully logged in
else:
nmsg = "Successfully Logged in."
nmsg = "<b>Congratulations🥳🥳</b>, <i>Your account is successfully logged in😊.</i>"

# Adding in db
collection_login.insert_one(
Expand All @@ -62,6 +65,9 @@ async def start_handler(bot:Update, msg:Message):

# If already logged in
else:
await msg.reply_text("Already Logged in.", parse_mode = 'html')
await msg.reply_text(
"<b>Your account is already login🤪.</b>",
parse_mode = 'html'
)
return

10 changes: 8 additions & 2 deletions plugins/logout.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ async def revoke_handler(bot:Update, msg:Message):
#Removing Login Detail from Database
collection_login.delete_one(query)

await msg.reply_text("BotMessage.logged_out", parse_mode = 'html')
await msg.reply_text(
"Your account is now logged out🥺.\nTo Login again send your login detail.",
parse_mode = 'html'
)

# If user not found in db
else:
await msg.reply_text("BotMessage.revoke_failed", parse_mode = 'html')
await msg.reply_text(
f"<b><u>You are not even logged in😒. So how can I remove your account.</u></b>{common_text}",
parse_mode = 'html'
)
return

57 changes: 37 additions & 20 deletions plugins/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,31 @@ async def uploaderHandler(bot:Update, msg:Message):
if await search_user_in_community(bot, msg):

pmsg = await msg.reply_text(
"We are finding your login details from our database.",
"<code>We are finding your login details from our database...</code>",
parse_mode = 'html'
)
loginDetail = getting_email_pass(msg.chat.id)
if loginDetail:
await pmsg.edit_text(
"Login details Found, Now verifying it.",
"<code>Login details Found, Now verifying it...</code>",
parse_mode = 'html'
)
email, password = loginDetail
mlog = loginInstance(email, password, bot)

if isinstance(mlog, int):
await pmsg.edit_text(
"Seems like login details is changed.",
f"Seems like your <b>Login Detail has changed.</b> /revoke this account, and add new login detail.{common_text}",
parse_mode = 'html'
)
elif not mlog:
await pmsg.edit_text(
"Something went wrong while login to your account.",
f"<b>Something went wrong while login to your account.</b>{common_text}",
parse_mode = 'html'
)
else:
await pmsg.edit_text(
"Login details successfully verifed. Now checking url.",
"<code>Login details successfully verifed. Now checking url...</code>",
parse_mode = 'html'
)
filename = None
Expand All @@ -61,15 +61,20 @@ async def uploaderHandler(bot:Update, msg:Message):
)
except Exception as e:
print(e)
return await pmsg.edit_text(
f"Something went wrong while attempting to download file.\n{e}"
await pmsg.edit_text(
f"<b>Something went wrong while attempting to download file.<b>\n{e}",
parse_mode = 'html'
)
await bot.send_message(
Config.OWNER_ID,
f"During Downloading file from this file.\n{e}"
)
return await msg.copy(Config.OWNER_ID)
else:
if not filepath:
return await pmsg.edit_text(
f"Something went wrong while attempting to download file.\n"
f"<b>Something went wrong while attempting to download file.</b>"
)
print(os.path.basename(filepath))
else:
urlText = msg.text

Expand All @@ -81,7 +86,7 @@ async def uploaderHandler(bot:Update, msg:Message):
filename = filename.strip()
else:
return pmsg.edit_text(
"Multiple <code>|</code>",
f"Don't use Multiple <code>|</code>{common_text}",
parse_mode = 'html'
)
else:
Expand All @@ -92,13 +97,17 @@ async def uploaderHandler(bot:Update, msg:Message):
except Exception as e:
print(e)
downObj.stop()
return await pmsg.edit_text(
f"Something went wrong while attempting to download file.\n{e}"
await pmsg.edit_text(
f"<b>Something went wrong while attempting to download file.</b>\n{e}"
)
return await bot.send_message(
Config.OWNER_ID,
f"During Downloading file from this url: {url}.\n{e}"
)
else:
if downObj.get_final_filesize() <= 2147483648:
await pmsg.edit_text(
"Url also verifed, Now downloading the file",
"<b>URL also verifed, Now downloading the file...</b>",
parse_mode = 'html'
)
while not downObj.isFinished():
Expand All @@ -122,20 +131,24 @@ async def uploaderHandler(bot:Update, msg:Message):
filepath = downObj.get_dest()
try:
await pmsg.edit_text(
"BotMessage.uploading_msg",
"<b>File successfully downloaded to server, 😊Now uploading to Drive.</b>",
parse_mode = 'html'
)
except exceptions.bad_request_400.MessageNotModified:
pass
else:
return await pmsg.edit_text(
"Something went wrong while downloading File",
await pmsg.edit_text(
f"<b>Something went wrong while downloading File</b>\n{downObj.get_errors()}",
parse_mode = 'html'
)
return await bot.send_message(
Config.OWNER_ID,
f"During Downloading file from this url: {url}.\n{downObj.get_errors()}"
)
else:
downObj.stop()
return await pmsg.edit_text(
"File size is more than limit."
f"I can't Upload file that are larger than 2000MB.{common_text}"
)
try:
await mlog.upload(
Expand All @@ -147,19 +160,23 @@ async def uploaderHandler(bot:Update, msg:Message):
except Exception as e:
print(e)
await pmsg.edit_text(
"Something went wrong while Uploading File.",
f"<b>Something went wrong while Uploading File.</b>\n{e}",
parse_mode = 'html'
)
await bot.send_message(
Config.OWNER_ID,
f"During Uploading file from this url: {url}.\n{e}"
)
else:
await pmsg.edit_text(
"File successfully Uploaded.",
"<b>Your file is successfully uploaded🥳🥳🥳.</b>",
parse_mode = 'html'
)
finally:
shutil.rmtree(downLoc)
else:
await pmsg.edit_text(
"You are not logged in.",
f"<i>Your account is not logged in😒, so I am unable to upload file.</i>{common_text}",
parse_mode = 'html'
)
return
Expand Down

0 comments on commit b170deb

Please sign in to comment.