Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Codeflix-Bots authored Mar 3, 2024
1 parent 81400fc commit 760acef
Show file tree
Hide file tree
Showing 7 changed files with 396 additions and 0 deletions.
15 changes: 15 additions & 0 deletions plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#(©)Codexbotz
#@iryme





from aiohttp import web
from .route import routes


async def web_server():
web_app = web.Application(client_max_size=30000000)
web_app.add_routes(routes)
return web_app
29 changes: 29 additions & 0 deletions plugins/cbb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#(©)Codexbotz

from pyrogram import __version__
from bot import Bot
from config import OWNER_ID
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery

@Bot.on_callback_query()
async def cb_handler(client: Bot, query: CallbackQuery):
data = query.data
if data == "about":
await query.message.edit_text(
text = f"<b>○ ᴏᴡɴᴇʀ : <a href='tg://user?id={OWNER_ID}'>ᴍɪᴋᴇʏ</a>\n○ ᴍʏ ᴜᴘᴅᴀᴛᴇs : <a href='https://t.me/CodeFlix_Bots'>ᴄᴏᴅᴇғʟɪx ʙᴏᴛs</a>○ ᴍᴏᴠɪᴇs ᴜᴘᴅᴀᴛᴇs : <a href='https://t.me/Team_Netflix'>ᴛᴇᴀᴍ ɴᴇᴛғʟɪx</a>\n○ ᴏᴜʀ ᴄᴏᴍᴍᴜɴɪᴛʏ : <a href='https://t.me/otakuflix_network'>ᴏᴛᴀᴋᴜғʟɪx ɴᴇᴛᴡᴏʀᴋ</a>\n○ ᴀɴɪᴍᴇ ᴄʜᴀᴛ : <a href='https://t.me/weebzonex'></a>ᴡᴇᴇʙ ᴢᴏɴᴇ</b>",
disable_web_page_preview = True,
reply_markup = InlineKeyboardMarkup(
[
[
InlineKeyboardButton("⚡️ ᴄʟᴏsᴇ", callback_data = "close"),
InlineKeyboardButton('🍁 ᴘʀᴇᴍɪᴜᴍ', url='https://t.me/OtakuFlix_Network/4639')
]
]
)
)
elif data == "close":
await query.message.delete()
try:
await query.message.reply_to_message.delete()
except:
pass
51 changes: 51 additions & 0 deletions plugins/channel_post.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#(©)Codexbotz

import asyncio
from pyrogram import filters, Client
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
from pyrogram.errors import FloodWait

from bot import Bot
from config import ADMINS, CHANNEL_ID, DISABLE_CHANNEL_BUTTON
from helper_func import encode

@Bot.on_message(filters.private & filters.user(ADMINS) & ~filters.command(['start','users','broadcast','batch','genlink','stats']))
async def channel_post(client: Client, message: Message):
reply_text = await message.reply_text("Please Wait...!", quote = True)
try:
post_message = await message.copy(chat_id = client.db_channel.id, disable_notification=True)
except FloodWait as e:
await asyncio.sleep(e.x)
post_message = await message.copy(chat_id = client.db_channel.id, disable_notification=True)
except Exception as e:
print(e)
await reply_text.edit_text("Something went Wrong..!")
return
converted_id = post_message.id * abs(client.db_channel.id)
string = f"get-{converted_id}"
base64_string = await encode(string)
link = f"https://t.me/{client.username}?start={base64_string}"

reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("🔁 Share URL", url=f'https://telegram.me/share/url?url={link}')]])

await reply_text.edit(f"<b>Here is your link</b>\n\n{link}", reply_markup=reply_markup, disable_web_page_preview = True)

if not DISABLE_CHANNEL_BUTTON:
await post_message.edit_reply_markup(reply_markup)

@Bot.on_message(filters.channel & filters.incoming & filters.chat(CHANNEL_ID))
async def new_post(client: Client, message: Message):

if DISABLE_CHANNEL_BUTTON:
return

converted_id = message.id * abs(client.db_channel.id)
string = f"get-{converted_id}"
base64_string = await encode(string)
link = f"https://t.me/{client.username}?start={base64_string}"
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("🔁 Share URL", url=f'https://telegram.me/share/url?url={link}')]])
try:
await message.edit_reply_markup(reply_markup)
except Exception as e:
print(e)
pass
60 changes: 60 additions & 0 deletions plugins/link_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#(©)Codexbotz

from pyrogram import Client, filters
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
from bot import Bot
from config import ADMINS
from helper_func import encode, get_message_id

@Bot.on_message(filters.private & filters.user(ADMINS) & filters.command('batch'))
async def batch(client: Client, message: Message):
while True:
try:
first_message = await client.ask(text = "Forward the First Message from DB Channel (with Quotes)..\n\nor Send the DB Channel Post Link", chat_id = message.from_user.id, filters=(filters.forwarded | (filters.text & ~filters.forwarded)), timeout=60)
except:
return
f_msg_id = await get_message_id(client, first_message)
if f_msg_id:
break
else:
await first_message.reply("❌ Error\n\nthis Forwarded Post is not from my DB Channel or this Link is taken from DB Channel", quote = True)
continue

while True:
try:
second_message = await client.ask(text = "Forward the Last Message from DB Channel (with Quotes)..\nor Send the DB Channel Post link", chat_id = message.from_user.id, filters=(filters.forwarded | (filters.text & ~filters.forwarded)), timeout=60)
except:
return
s_msg_id = await get_message_id(client, second_message)
if s_msg_id:
break
else:
await second_message.reply("❌ Error\n\nthis Forwarded Post is not from my DB Channel or this Link is taken from DB Channel", quote = True)
continue


string = f"get-{f_msg_id * abs(client.db_channel.id)}-{s_msg_id * abs(client.db_channel.id)}"
base64_string = await encode(string)
link = f"https://t.me/{client.username}?start={base64_string}"
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("🔁 Share URL", url=f'https://telegram.me/share/url?url={link}')]])
await second_message.reply_text(f"<b>Here is your link</b>\n\n{link}", quote=True, reply_markup=reply_markup)


@Bot.on_message(filters.private & filters.user(ADMINS) & filters.command('genlink'))
async def link_generator(client: Client, message: Message):
while True:
try:
channel_message = await client.ask(text = "Forward Message from the DB Channel (with Quotes)..\nor Send the DB Channel Post link", chat_id = message.from_user.id, filters=(filters.forwarded | (filters.text & ~filters.forwarded)), timeout=60)
except:
return
msg_id = await get_message_id(client, channel_message)
if msg_id:
break
else:
await channel_message.reply("❌ Error\n\nthis Forwarded Post is not from my DB Channel or this Link is not taken from DB Channel", quote = True)
continue

base64_string = await encode(f"get-{msg_id * abs(client.db_channel.id)}")
link = f"https://t.me/{client.username}?start={base64_string}"
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("🔁 Share URL", url=f'https://telegram.me/share/url?url={link}')]])
await channel_message.reply_text(f"<b>Here is your link</b>\n\n{link}", quote=True, reply_markup=reply_markup)
14 changes: 14 additions & 0 deletions plugins/route.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#(©)Codeflix_Bots
#rymme





from aiohttp import web

routes = web.RouteTableDef()

@routes.get("/", allow_head=True)
async def root_route_handler(request):
return web.json_response("Codeflix_Bots (Telegram)")
208 changes: 208 additions & 0 deletions plugins/start.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
#(©)Codeflix_Bots




import os
import asyncio
from pyrogram import Client, filters, __version__
from pyrogram.enums import ParseMode
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery
from pyrogram.errors import FloodWait, UserIsBlocked, InputUserDeactivated

from bot import Bot
from config import ADMINS, FORCE_MSG, START_MSG, CUSTOM_CAPTION, DISABLE_CHANNEL_BUTTON, PROTECT_CONTENT
from helper_func import subscribed, encode, decode, get_messages
from database.database import add_user, del_user, full_userbase, present_user




@Bot.on_message(filters.command('start') & filters.private & subscribed)
async def start_command(client: Client, message: Message):
id = message.from_user.id
if not await present_user(id):
try:
await add_user(id)
except:
pass
text = message.text
if len(text)>7:
try:
base64_string = text.split(" ", 1)[1]
except:
return
string = await decode(base64_string)
argument = string.split("-")
if len(argument) == 3:
try:
start = int(int(argument[1]) / abs(client.db_channel.id))
end = int(int(argument[2]) / abs(client.db_channel.id))
except:
return
if start <= end:
ids = range(start,end+1)
else:
ids = []
i = start
while True:
ids.append(i)
i -= 1
if i < end:
break
elif len(argument) == 2:
try:
ids = [int(int(argument[1]) / abs(client.db_channel.id))]
except:
return
temp_msg = await message.reply("ᴡᴀɪᴛ ʙʀᴏᴏ...")
try:
messages = await get_messages(client, ids)
except:
await message.reply_text("Something went wrong..!")
return
await temp_msg.delete()

for msg in messages:

if bool(CUSTOM_CAPTION) & bool(msg.document):
caption = CUSTOM_CAPTION.format(previouscaption = "" if not msg.caption else msg.caption.html, filename = msg.document.file_name)
else:
caption = "" if not msg.caption else msg.caption.html

if DISABLE_CHANNEL_BUTTON:
reply_markup = msg.reply_markup
else:
reply_markup = None

try:
await msg.copy(chat_id=message.from_user.id, caption = caption, parse_mode = ParseMode.HTML, reply_markup = reply_markup, protect_content=PROTECT_CONTENT)
await asyncio.sleep(0.5)
except FloodWait as e:
await asyncio.sleep(e.x)
await msg.copy(chat_id=message.from_user.id, caption = caption, parse_mode = ParseMode.HTML, reply_markup = reply_markup, protect_content=PROTECT_CONTENT)
except:
pass
return
else:
reply_markup = InlineKeyboardMarkup(
[
[
InlineKeyboardButton("⚡️ ᴀʙᴏᴜᴛ", callback_data = "about"),
InlineKeyboardButton('🍁 ᴜᴘᴅᴀᴛᴇs', url='https://t.me/codeflix_bots')
]
]
)
await message.reply_text(
text = START_MSG.format(
first = message.from_user.first_name,
last = message.from_user.last_name,
username = None if not message.from_user.username else '@' + message.from_user.username,
mention = message.from_user.mention,
id = message.from_user.id
),
reply_markup = reply_markup,
disable_web_page_preview = True,
quote = True
)
return


#=====================================================================================##

WAIT_MSG = """"<b>Processing ...</b>"""

REPLY_ERROR = """<code>Use this command as a replay to any telegram message with out any spaces.</code>"""

#=====================================================================================##



@Bot.on_message(filters.command('start') & filters.private)
async def not_joined(client: Client, message: Message):
buttons = [
[
InlineKeyboardButton(text="ᴄʜᴀɴɴᴇʟ 𝟷 🦊", url=client.invitelink),
InlineKeyboardButton(text="ᴄʜᴀɴɴᴇʟ 𝟸 🐭", url=client.invitelink2),
],
[
InlineKeyboardButton(text="ᴄʜᴀɴɴᴇʟ 𝟹 🐰", url=client.invitelink3),
InlineKeyboardButton(text="ᴄʜᴀɴɴᴇʟ 𝟺 🐼", url=client.invitelink4),
]
]
try:
buttons.append(
[
InlineKeyboardButton(
text = 'Rᴇʟᴏᴀᴅ 💁‍♂️',
url = f"https://t.me/{client.username}?start={message.command[1]}"
)
]
)
except IndexError:
pass

await message.reply(
text = FORCE_MSG.format(
first = message.from_user.first_name,
last = message.from_user.last_name,
username = None if not message.from_user.username else '@' + message.from_user.username,
mention = message.from_user.mention,
id = message.from_user.id
),
reply_markup = InlineKeyboardMarkup(buttons),
quote = True,
disable_web_page_preview = True
)

@Bot.on_message(filters.command('users') & filters.private & filters.user(ADMINS))
async def get_users(client: Bot, message: Message):
msg = await client.send_message(chat_id=message.chat.id, text=WAIT_MSG)
users = await full_userbase()
await msg.edit(f"{len(users)} users are using this bot")

@Bot.on_message(filters.private & filters.command('broadcast') & filters.user(ADMINS))
async def send_text(client: Bot, message: Message):
if message.reply_to_message:
query = await full_userbase()
broadcast_msg = message.reply_to_message
total = 0
successful = 0
blocked = 0
deleted = 0
unsuccessful = 0

pls_wait = await message.reply("<i>Broadcasting Message.. This will Take Some Time</i>")
for chat_id in query:
try:
await broadcast_msg.copy(chat_id)
successful += 1
except FloodWait as e:
await asyncio.sleep(e.x)
await broadcast_msg.copy(chat_id)
successful += 1
except UserIsBlocked:
await del_user(chat_id)
blocked += 1
except InputUserDeactivated:
await del_user(chat_id)
deleted += 1
except:
unsuccessful += 1
pass
total += 1

status = f"""<b><u>Broadcast Completed</u>
Total Users: <code>{total}</code>
Successful: <code>{successful}</code>
Blocked Users: <code>{blocked}</code>
Deleted Accounts: <code>{deleted}</code>
Unsuccessful: <code>{unsuccessful}</code></b>"""

return await pls_wait.edit(status)

else:
msg = await message.reply(REPLY_ERROR)
await asyncio.sleep(8)
await msg.delete()
Loading

0 comments on commit 760acef

Please sign in to comment.