Skip to content

Commit

Permalink
Telegram MixDrop Bot 🤪
Browse files Browse the repository at this point in the history
  • Loading branch information
abhint authored Jan 5, 2021
1 parent 87eef3d commit 8b6e252
Show file tree
Hide file tree
Showing 10 changed files with 185 additions and 0 deletions.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
worker: python3 -m bot
13 changes: 13 additions & 0 deletions bot/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env python3
# This is bot coded by Abhijith-cloud and used for educational purposes only
# https://github.com/Abhijith-cloud
# (c) Abhijith N T ;-)
# Thank you https://github.com/pyrogram/pyrogram :-)

import os

class msg():
source = "\nsource:https://github.com/Abhijith-cloud/Telegram-MixDrop-Bot"
start = "\n<b>@thankappan369</b>"
error = "something is went wrong\n{error} \ncontact admin @thankappan369"
help = ""
20 changes: 20 additions & 0 deletions bot/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python3
# This is bot coded by Abhijith-cloud and used for educational purposes only
# https://github.com/Abhijith-cloud
# (c) Abhijith N T ;-)
# Thank you https://github.com/pyrogram/pyrogram :-)


from pyrogram import Client
# from env import ev_data

bot = Client(
"Telegram MixDrop Bot",
bot_token = "", #ev_data.BOT_TOKEN
api_id = 1234, #ev_data.API_ID
api_hash = "", #ev_data.API_HASH,
plugins = {
"root":"bot/plugins"
}
)
bot.run()
19 changes: 19 additions & 0 deletions bot/plugins/cmd/qr_cmd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from pyrogram import Client,filters
from bot import msg

@Client.on_message(filters.command(["start"]))
async def start(client, message):
await client.send_message(
chat_id=message.chat.id,
text=f"Hey {message.from_user.first_name},{msg.start}{msg.source}",
reply_to_message_id=message.message_id,
parse_mode = "html"
)
@Client.on_message(filters.command(["help","h"]))
async def help(client, message):
await client.send_message(
chat_id=message.chat.id,
text=f"Hey {message.from_user.first_name},{msg.help}{msg.source}",
reply_to_message_id=message.message_id,
parse_mode = "html"
)
17 changes: 17 additions & 0 deletions bot/plugins/display/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env python3
# This is bot coded by Abhijith-cloud and used for educational purposes only
# https://github.com/Abhijith-cloud
# (c) Abhijith N T ;-)
# Thank you https://github.com/pyrogram/pyrogram :-)

from bot.plugins.display.time import time_data

async def progress(current, total,up_msg, message, start_time):

try:
await message.edit(
text = f"{up_msg} {current * 100 / total:.1f}% in {time_data(start_time)}"
)
except:
pass

19 changes: 19 additions & 0 deletions bot/plugins/display/time.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import time

def time_data(start_time):
end = time.time()
now = end - start_time
now_time = now
day = now_time // (24 * 3600)
now_time = now_time % (24 * 3600)
hour = now_time // 3600
now_time %= 3600
minutes = now_time // 60
now_time %= 60
seconds = now_time
if(day!=0):
return "%dd %dh %dm %ds" % (day, hour, minutes, seconds)
if(hour!=0):
return "%dh %dm %ds" % (hour, minutes, seconds)
else:
return "%dm %ds" % (minutes, seconds)
61 changes: 61 additions & 0 deletions bot/plugins/helpers/get_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env python3
# This is bot coded by Abhijith-cloud and used for educational purposes only
# https://github.com/Abhijith-cloud
# (c) Abhijith N T ;-)
# Thank you https://github.com/pyrogram/pyrogram :-)

from pyrogram import Client,filters
from pyrogram.types.messages_and_media.message import Message
from bot.plugins.helpers.mixdrop_upload import mixFileup
from bot.plugins.display import progress
import time, os
from hurry.filesize import size
from pyrogram.types import (
InlineKeyboardMarkup,
InlineKeyboardButton
)

@Client.on_message(filters.media)
async def userMedia(client, bot):
now = time.time()
link = ''
f_size = ''
f_name = ''
file = ''
userMsg = await client.send_message(
chat_id=bot.chat.id,
text = "processing your request...please wait"
)
try:
file = await bot.download(
progress = progress,
progress_args = (
'Downloading....',
userMsg,
now
)
)
f_size = os.path.getsize(file)
f_name = file.split('/')[-1]
link = await mixFileup(file, userMsg, now)
for i in link:
pass
except Exception as error:
print(error)
await bot.reply(
text = f"File Name: {f_name}\nSIZE: {size(f_size)}",
reply_markup=InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
"DOWNLOAD !",
url=f"{link}"
),
],
]
)
)
try:
os.remove(file)
except Exception as error:
print(error)
30 changes: 30 additions & 0 deletions bot/plugins/helpers/mixdrop_upload.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from logging import error
import aiohttp
from bot.plugins.display.time import time_data

async def mixFileup(file, bot, s_time):
#https://github.com/odysseusmax/uploads/blob/master/mixdrop.py
try:
await bot.edit(
text = "Uploadig to MixDrop.."
)
email = "[email protected]"
api_key = "TUtD1QIPwPyaoHql14C"
upload_url = "https://ul.mixdrop.co/api"
async with aiohttp.ClientSession() as session:
file_to_upload = file
data = {
'file': open(file_to_upload, 'rb'),
'email': email,
'key': api_key
}
response = await session.post(upload_url, data=data)
link = await response.json()
await bot.edit(
text = f"Uploaded...100% in {time_data(s_time)}"
)
return f"https://mixdrop.co/f/{link['result']['fileref']}"
except Exception as eror:
print(error)


4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Pyrogram
TgCrypto
aiohttp
hurry.filesize
1 change: 1 addition & 0 deletions runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-3.9.1

0 comments on commit 8b6e252

Please sign in to comment.