Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix auth channel #25

Open
wants to merge 14 commits into
base: Tamilans-Working-Branch
Choose a base branch
from
21 changes: 9 additions & 12 deletions Script.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class script(object):
START_TXT = """<b>Hᴇʏ {} ɪᴍ 『 ᴍᴏᴠɪᴇs ғɪʟᴛᴇʀ ʙᴏᴛ 』 ᴀɴ Aᴡᴇsᴏᴍᴇ Aᴜᴛᴏ + Mᴀɴᴜᴀʟ Fɪʟᴛᴇʀ + Fɪʟᴇ Sʜᴀʀᴇ Bᴏᴛ.
Aᴅᴅ Mᴇ Tᴏ Yᴏᴜʀ Gʀᴏᴜᴩ Nᴏᴡ 👇</b>"""
START_TXT = """<b>Hᴇʏ {} 👋🏻 ɪᴍ ꪜꫀꪀꪮꪑ.
ᴀɴ Aᴡᴇsᴏᴍᴇ Aᴜᴛᴏ + Mᴀɴᴜᴀʟ Fɪʟᴛᴇʀ + Fɪʟᴇ Sʜᴀʀᴇ Bᴏᴛ.
Jᴏɪɴ Oᴜʀ Gʀᴏᴜᴘ Oʀ Aᴅᴅ Mᴇ Tᴏ Yᴏᴜʀ Gʀᴏᴜᴩ Nᴏᴡ 👇</b>"""

HELP_TXT = """<b>Hᴇʏ {} Fʀɪᴇɴᴅ Hᴇʀᴇ Yᴏᴜʀ Bᴜᴛᴛᴏɴs 👇</b>"""

Expand All @@ -21,23 +22,19 @@ class script(object):

PONG_TXT = """Cʜᴇᴄᴋ Mʏ Pɪɴɢ Bʏ Cʟɪᴄᴋɪɴɢ 👉 /ping"""

ABOUT_TXT = """<b>🤖 ᴍʏ ɴᴀᴍᴇ : <a href=https://t.me/Tamilanz_Auto_Filter_Bot>ᴍᴏᴠɪᴇs ғɪʟᴛᴇʀ ʙᴏᴛ</a>
👨‍💻 ᴅᴇᴠᴇʟᴏᴘᴇʀ : <a href=https://t.me/Sharathitsisme>sʜᴀʀᴀᴛʜ</a>
ABOUT_TXT = """<b>🤖 ᴍʏ ɴᴀᴍᴇ : <a href=https://t.me/venomfilter_bot>ᴠᴇɴᴏᴍ</a>
👨‍💻 ᴅᴇᴠᴇʟᴏᴘᴇʀ : <a href=https://t.me/i_hackerdoc>ᴀɴᴏɴʏᴍᴏᴜꜱ</a>
📝 ʟᴀɴɢᴜᴀɢᴇ : ᴘʏʀᴏɢʀᴀᴍ
📚 ꜰʀᴀᴍᴇᴡᴏʀᴋ : ᴘʏᴛʜᴏɴ 3
📡 ʜᴏsᴛᴇᴅ ᴏɴ : ғʀᴇᴇ ʜᴏsᴛɪɴɢ
📢 sᴜᴘᴘᴏʀᴛ ɢʀᴏᴜᴘ : <a href=https://t.me/TamilanMoviesChat>ᴄʟɪᴄᴋ ʜᴇʀᴇ</a>
🌟 Sᴏᴜʀᴄᴇ Cᴏᴅᴇ : <a href=https://github.com/TamilanBotsZ/PremiumFilter>ʀᴇᴩᴏ ʟɪɴᴋ</a></b>"""
📢 sᴜᴘᴘᴏʀᴛ ɢʀᴏᴜᴘ : <a href=https://t.me/MovieTime_Movie_Request_Group>ᴄʟɪᴄᴋ ʜᴇʀᴇ</a>
🌟 Sᴏᴜʀᴄᴇ Cᴏᴅᴇ : <a href=https://github.com/ihackerdoc/PremiumFilter>ʀᴇᴩᴏ ʟɪɴᴋ</a></b>"""

SOURCES_TXT = """Tʜɪs Is Aɴ Oᴩᴇɴ-Sᴏᴜʀᴄᴇ Pʀᴏᴊᴇᴄᴛ Bʏ @Tamilan_BotsZ

- 100﹪ Cᴏᴅᴇᴅ Bʏ <a href=https://t.me/SharathItsIsme>sʜᴀʀᴀᴛʜ</a>
SOURCES_TXT = """Tʜɪs Is Aɴ Oᴩᴇɴ-Sᴏᴜʀᴄᴇ Pʀᴏᴊᴇᴄᴛ Bʏ @dochacks

- & Rᴇᴩᴏ Lɪɴᴋ 👇 Hᴇʀᴇ"""

SOURCE_TXT = """Tʜɪs Is Aɴ Oᴩᴇɴ-Sᴏᴜʀᴄᴇ Pʀᴏᴊᴇᴄᴛ Bʏ @Tamilan_BotsZ</b>

- 100﹪ Cᴏᴅᴇᴅ Bʏ <a href=https://t.me/SharathItsIsme>sʜᴀʀᴀᴛʜ</a></b>
SOURCE_TXT = """Tʜɪs Is Aɴ Oᴩᴇɴ-Sᴏᴜʀᴄᴇ Pʀᴏᴊᴇᴄᴛ Bʏ @dochacks</b>

- Rᴇᴩᴏ Lɪɴᴋ 👇 Hᴇʀᴇ"""

Expand Down
39 changes: 22 additions & 17 deletions info.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from os import environ

id_pattern = re.compile(r'^.\d+$')

def is_enabled(value, default):
if value.lower() in ["true", "yes", "1", "enable", "y"]:
return True
Expand All @@ -15,6 +16,7 @@ def is_enabled(value, default):
API_ID = int(environ.get('API_ID', ''))
API_HASH = environ.get('API_HASH', '')
BOT_TOKEN = environ.get('BOT_TOKEN', '')

# Bot settings
CACHE_TIME = int(environ.get('CACHE_TIME', 300))
USE_CAPTION_FILTER = bool(environ.get('USE_CAPTION_FILTER', True))
Expand All @@ -25,52 +27,55 @@ def is_enabled(value, default):
CHANNELS = [int(ch) if id_pattern.search(ch) else ch for ch in environ.get('CHANNELS', '').split()]
auth_users = [int(user) if id_pattern.search(user) else user for user in environ.get('AUTH_USERS', '').split()]
AUTH_USERS = (auth_users + ADMINS) if auth_users else []
auth_channel = environ.get('AUTH_CHANNEL')
auth_channel = environ.get('AUTH_CHANNEL', '-1002455627732')
auth_grp = environ.get('AUTH_GROUP')
AUTH_CHANNEL = int(auth_channel) if auth_channel and id_pattern.search(auth_channel) else None
AUTH_GROUPS = [int(ch) for ch in auth_grp.split()] if auth_grp else None

# Log the value of AUTH_CHANNEL
print(f"AUTH_CHANNEL: {AUTH_CHANNEL}")

# MongoDB information
DATABASE_URI = environ.get('DATABASE_URI', "")
DATABASE_NAME = environ.get('DATABASE_NAME', "")
COLLECTION_NAME = environ.get('COLLECTION_NAME', 'Telegram_files')

# Others
LOG_CHANNEL = int(environ.get('LOG_CHANNEL', ))
LOG_CHANNEL = int(environ.get('LOG_CHANNEL', '-1002227324253'))
SUPPORT_CHAT = environ.get('SUPPORT_CHAT', '')
P_TTI_SHOW_OFF = is_enabled((environ.get('P_TTI_SHOW_OFF', "False")), False)
IMDB = is_enabled((environ.get('IMDB', "False")), False)
SINGLE_BUTTON = is_enabled((environ.get('SINGLE_BUTTON', "True")), True)
CUSTOM_FILE_CAPTION = environ.get("CUSTOM_FILE_CAPTION", "<code>{file_name}</code>")
SINGLE_BUTTON = is_enabled((environ.get('SINGLE_BUTTON', "False")), False)
CUSTOM_FILE_CAPTION = environ.get("CUSTOM_FILE_CAPTION", "{file_name}\n•────•────────•────•\n📌 ᴊᴏɪɴ : <a href=\"https://t.me/MovieTime_Movie_Request_Group\">ᴍᴏᴠɪᴇᴛɪᴍᴇ</a> 🎬\n📌 ᴊᴏɪɴ : <a href=\"https://t.me/+prlX5HRWM-cyMmE1\">ᴍᴏᴠɪᴇꜰɪʟᴇꜱ</a> 📁\n📌 ᴊᴏɪɴ : <a href=\"https://t.me/+7D7GmraxuUY3Yzk1\">ᴡᴇʙꜱʜᴏᴡꜱ</a> 🍿\n📌 ꜱᴜʙꜱᴄʀɪʙᴇ ɴᴏᴡ : <a href=\"https://t.me/latest_hindi_movies_hub\">ᴄʟɪᴄᴋ</a> 👈🏻\n•────•────────•────•\n🎗 ʝσιи • ѕнαяє • ѕυρρσят 🎗")
BATCH_FILE_CAPTION = environ.get("BATCH_FILE_CAPTION", CUSTOM_FILE_CAPTION)
IMDB_TEMPLATE = environ.get("IMDB_TEMPLATE", "<b>Query: {query}</b> \n‌IMDb Data:\n\n🏷 Title: <a href={url}>{title}</a>\n🎭 Genres: {genres}\n📆 Year: <a href={url}/releaseinfo>{year}</a>\n🌟 Rating: <a href={url}/ratings>{rating}</a> / 10")
LONG_IMDB_DESCRIPTION = is_enabled(environ.get("LONG_IMDB_DESCRIPTION", "False"), False)
SPELL_CHECK_REPLY = is_enabled(environ.get("SPELL_CHECK_REPLY", "True"), True)
MAX_LIST_ELM = environ.get("MAX_LIST_ELM", None)
INDEX_REQ_CHANNEL = int(environ.get('INDEX_REQ_CHANNEL', LOG_CHANNEL))
FILE_STORE_CHANNEL = [int(ch) for ch in (environ.get('FILE_STORE_CHANNEL', '')).split()]
FILE_STORE_CHANNEL = [int(ch) for ch in (environ.get('FILE_STORE_CHANNEL', '-1002379981847')).split()]
MELCOW_NEW_USERS = is_enabled((environ.get('MELCOW_NEW_USERS', "False")), False)
PROTECT_CONTENT = is_enabled((environ.get('PROTECT_CONTENT', "False")), False)
PUBLIC_FILE_STORE = is_enabled((environ.get('PUBLIC_FILE_STORE', "True")), True)

LOG_STR = "Current Cusomized Configurations are:-\n"
LOG_STR += ("IMDB Results are enabled, Bot will be showing imdb details for you queries.\n" if IMDB else "IMBD Results are disabled.\n")
LOG_STR += ("P_TTI_SHOW_OFF found , Users will be redirected to send /start to Bot PM instead of sending file file directly\n" if P_TTI_SHOW_OFF else "P_TTI_SHOW_OFF is disabled files will be send in PM, instead of sending start.\n")
LOG_STR += ("SINGLE_BUTTON is Found, filename and files size will be shown in a single button instead of two separate buttons\n" if SINGLE_BUTTON else "SINGLE_BUTTON is disabled , filename and file_sixe will be shown as different buttons\n")
LOG_STR += (f"CUSTOM_FILE_CAPTION enabled with value {CUSTOM_FILE_CAPTION}, your files will be send along with this customized caption.\n" if CUSTOM_FILE_CAPTION else "No CUSTOM_FILE_CAPTION Found, Default captions of file will be used.\n")
LOG_STR += ("Long IMDB storyline enabled." if LONG_IMDB_DESCRIPTION else "LONG_IMDB_DESCRIPTION is disabled , Plot will be shorter.\n")
LOG_STR = "Current Customized Configurations are:-\n"
LOG_STR += ("IMDB Results are enabled, Bot will be showing imdb details for your queries.\n" if IMDB else "IMDB Results are disabled.\n")
LOG_STR += ("P_TTI_SHOW_OFF found, Users will be redirected to send /start to Bot PM instead of sending file directly\n" if P_TTI_SHOW_OFF else "P_TTI_SHOW_OFF is disabled, files will be sent in PM instead of sending start.\n")
LOG_STR += ("SINGLE_BUTTON is Found, filename and file size will be shown in a single button instead of two separate buttons\n" if SINGLE_BUTTON else "SINGLE_BUTTON is disabled, filename and file size will be shown as different buttons\n")
LOG_STR += (f"CUSTOM_FILE_CAPTION enabled with value {CUSTOM_FILE_CAPTION}, your files will be sent along with this customized caption.\n" if CUSTOM_FILE_CAPTION else "No CUSTOM_FILE_CAPTION Found, Default captions of file will be used.\n")
LOG_STR += ("Long IMDB storyline enabled." if LONG_IMDB_DESCRIPTION else "LONG_IMDB_DESCRIPTION is disabled, Plot will be shorter.\n")
LOG_STR += ("Spell Check Mode Is Enabled, bot will be suggesting related movies if movie not found\n" if SPELL_CHECK_REPLY else "SPELL_CHECK_REPLY Mode disabled\n")
LOG_STR += (f"MAX_LIST_ELM Found, long list will be shortened to first {MAX_LIST_ELM} elements\n" if MAX_LIST_ELM else "Full List of casts and crew will be shown in imdb template, restrict them by adding a value to MAX_LIST_ELM\n")
LOG_STR += f"Your current IMDB template is {IMDB_TEMPLATE}"

HOW_TO_DOWNLOAD = environ.get('HOW_TO_DOWNLOAD', 'https://t.me/Sharath_Links/13')
HOW_TO_DOWNLOAD = environ.get('HOW_TO_DOWNLOAD', 'https://t.me/Sharath_Links/13')

AUTO_DELETE_SECONDS = int(environ.get('AUTO_DELETE_SECONDS', 100))
AUTO_DELETE_SECONDS = int(environ.get('AUTO_DELETE_SECONDS', 300))

FILE_REQ_CHANNEL = int(environ.get('FILE_REQ_CHANNEL', LOG_CHANNEL))
FILE_REQ_CHANNEL = int(environ.get('FILE_REQ_CHANNEL', ''))

SHORTNER_SITE = environ.get('SHORTNER_SITE', '') #Put Only Shortner Site domain don't put like this https://tnlink.in/
SHORTNER_SITE = environ.get('SHORTNER_SITE', '') # Put Only Shortner Site domain don't put like this https://tnlink.in/

SHORTNER_API = environ.get('SHORTNER_API', '')
SHORTNER_API = environ.get('SHORTNER_API', '')

AUTO_DELETE = environ.get('AUTO_DELETE', 'True')
AUTO_DELETE = environ.get('AUTO_DELETE', 'True')
15 changes: 15 additions & 0 deletions plugins/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from database.users_chats_db import db
from info import CHANNELS, ADMINS, AUTH_CHANNEL, LOG_CHANNEL, PICS, BATCH_FILE_CAPTION, CUSTOM_FILE_CAPTION, PROTECT_CONTENT
from utils import get_settings, get_size, is_subscribed, save_group_settings, temp
from utils import get_chat_member
from database.connections_mdb import active_connection
import re
import json
Expand All @@ -18,6 +19,20 @@

BATCH_FILES = {}


async def some_command_handler(update, context):
user_id = update.effective_user.id
chat_id = AUTH_CHANNEL # or another channel ID

member = await get_chat_member(context.bot, chat_id, user_id)
if member:
# Process member info
await update.message.reply_text(f"Welcome, {member.user.first_name}!")
else:
# Handle the case where member info couldn't be retrieved
await update.message.reply_text("Could not fetch member info.")


@Client.on_message(filters.command("start") & filters.incoming)
async def start(client, message):
if message.chat.type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
Expand Down
20 changes: 10 additions & 10 deletions plugins/pm_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ async def cb_handler(client: Client, query: CallbackQuery):
return
else:
g = short_url(f"https://t.me/{temp.U_NAME}?start={ident}_{file_id}")
await client.send_photo(chat_id=query.from_user.id, photo='https://graph.org/file/f7f173057c2b76940c79c.jpg', caption = f"<b>📕Nᴀᴍᴇ ➠ : <code>{files.file_name}</code> \n\n🔗Sɪᴢᴇ ➠ : {get_size(files.file_size)}</b>",
await client.send_photo(chat_id=query.from_user.id, photo='https://envs.sh/07P.jpg', caption = f"<b>📕Nᴀᴍᴇ ➠ : <code>{files.file_name}</code> \n\n🔗Sɪᴢᴇ ➠ : {get_size(files.file_size)}</b>",
reply_markup=InlineKeyboardMarkup(
[
[
Expand Down Expand Up @@ -440,8 +440,8 @@ async def cb_handler(client: Client, query: CallbackQuery):
buttons = [[
InlineKeyboardButton('➕ Aᴅᴅ Mᴇ Tᴏ Yᴏᴜʀ Gʀᴏᴜᴘ ➕', url=f"https://t.me/{temp.U_NAME}?startgroup=true")
],[
InlineKeyboardButton('💥 Mᴏᴠɪᴇ Uᴘᴅᴀᴛᴇs 💥', url='https://t.me/+5aoApavIMVo1YzQ1'),
InlineKeyboardButton('🔎 Sᴇᴀʀᴄʜ Gʀᴏᴜᴘ 🔍', url='https://t.me/TamilanMoviesChat')
InlineKeyboardButton('💥 Mᴏᴠɪᴇ Uᴘᴅᴀᴛᴇs 💥', url='https://t.me/latest_hindi_movies_hub'),
InlineKeyboardButton('🔎 Sᴇᴀʀᴄʜ Gʀᴏᴜᴘ 🔍', url='https://t.me/MovieTime_Movie_Request_Group')
],[
InlineKeyboardButton('😅 Sᴏᴜʀᴄᴇ Cᴏᴅᴇ 😊', callback_data='sources')
],[
Expand All @@ -457,7 +457,7 @@ async def cb_handler(client: Client, query: CallbackQuery):
)
elif query.data == "about":
buttons = [[
InlineKeyboardButton('🤖 Uᴩᴅᴀᴛᴇs 😜', url='https://t.me/Tamilan_BotsZ'),
InlineKeyboardButton('🤖 Uᴩᴅᴀᴛᴇs 😜', url='https://t.me/ihackerdoc'),
InlineKeyboardButton('♥️ Sʜᴀʀᴇ Mᴇ 💫', url=f"https://t.me/share/url?url=t.me/{temp.U_NAME}")
], [
InlineKeyboardButton('🔭 Sᴛᴀᴛs 📊', callback_data='stats'),
Expand Down Expand Up @@ -495,7 +495,7 @@ async def cb_handler(client: Client, query: CallbackQuery):
],[
InlineKeyboardButton('🔭 Sᴛᴀᴛs 📊', callback_data='stats')
],[
InlineKeyboardButton('😊 Sᴏᴜʀᴄᴇ Cᴏᴅᴇ ☺', url='https://Github.com/TamilanBotsZ/PremiumFilter')
InlineKeyboardButton('😊 Sᴏᴜʀᴄᴇ Cᴏᴅᴇ ☺', url='https://Github.com/ihackerdoc/PremiumFilter')
],[
InlineKeyboardButton('‹‹‹ Bᴀᴄᴋ', callback_data='about')
]]
Expand Down Expand Up @@ -578,7 +578,7 @@ async def cb_handler(client: Client, query: CallbackQuery):
elif query.data == "sources":
buttons = [[

InlineKeyboardButton('😊 Rᴇᴩᴏ 😊', url='https://Github.com/TamilanBotsZ/PremiumFilter')
InlineKeyboardButton('😊 Rᴇᴩᴏ 😊', url='https://Github.com/ihackerdoc/PremiumFilter')
], [
InlineKeyboardButton('‹‹‹ Bᴀᴄᴋ', callback_data='start')
]]
Expand All @@ -591,7 +591,7 @@ async def cb_handler(client: Client, query: CallbackQuery):
elif query.data == "source":
buttons = [[

InlineKeyboardButton('😊 Rᴇᴩᴏ 😊', url='https://Github.com/TamilanBotsZ/PremiumFilter')
InlineKeyboardButton('😊 Rᴇᴩᴏ 😊', url='https://Github.com/ihackerdoc/PremiumFilter')
], [
InlineKeyboardButton('‹‹‹ Bᴀᴄᴋ', callback_data='about')
]]
Expand All @@ -603,7 +603,7 @@ async def cb_handler(client: Client, query: CallbackQuery):
)
elif query.data == "info":
buttons = [[
InlineKeyboardButton('😪 Hᴏᴡ Tᴏ Oᴩᴇɴ Mʏ Lɪɴᴋs 💢', url='https://t.me/Sharath_Links/13')
InlineKeyboardButton('😪 Hᴏᴡ Tᴏ Oᴩᴇɴ Mʏ Lɪɴᴋs 💢', url='https://t.me/ihackerdoc/3')
], [
InlineKeyboardButton('📞 Cᴏɴᴛᴀᴄᴛ 📟', callback_data='contact')
], [
Expand All @@ -617,9 +617,9 @@ async def cb_handler(client: Client, query: CallbackQuery):
)
elif query.data == "contact":
buttons = [[
InlineKeyboardButton('😳 Cʀᴇᴀᴛᴏʀ 😳', url='https://t.me/SharathItsIsMe')
InlineKeyboardButton('😳 Cʀᴇᴀᴛᴏʀ 😳', url='https://t.me/dochacks')
], [
InlineKeyboardButton('📞 Cᴏɴᴛᴀᴄᴛ 📟', url='https://t.me/TamilanBotsZ_Support')
InlineKeyboardButton('📞 Cᴏɴᴛᴀᴄᴛ 📟', url='https://t.me/i_hackerdoc')
], [
InlineKeyboardButton('‹‹‹ Bᴀᴄᴋ', callback_data='about')
], [
Expand Down
10 changes: 10 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from pyrogram import Client as Bot
import logging
from pyrogram.errors import InputUserDeactivated, UserNotParticipant, FloodWait, UserIsBlocked, PeerIdInvalid
from info import *
Expand Down Expand Up @@ -45,6 +46,15 @@ class temp(object):
U_NAME = None
B_NAME = None
SETTINGS = {}


async def get_chat_member(bot: Bot, chat_id: int, user_id: int):
try:
chat_member = await bot.get_chat_member(chat_id, user_id)
return chat_member
except TelegramError as e:
logger.error(f"Error fetching chat member: {e}")
return None

async def is_subscribed(bot, query):
try:
Expand Down