Skip to content

Commit

Permalink
no! let owner decides
Browse files Browse the repository at this point in the history
  • Loading branch information
subinps committed Jan 19, 2022
1 parent d136229 commit f6d1056
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions info.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def is_enabled(value, default):
FILE_STORE_CHANNEL = [int(ch) for ch in (environ.get('FILE_STORE_CHANNEL', '')).split()]
MELCOW_NEW_USERS = is_enabled((environ.get('MELCOW_NEW_USERS', "True")), True)
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")
Expand Down
13 changes: 10 additions & 3 deletions plugins/genlink.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re
from pyrogram import filters, Client
from pyrogram.errors.exceptions.bad_request_400 import ChannelInvalid, UsernameInvalid, UsernameNotModified
from info import ADMINS, LOG_CHANNEL, FILE_STORE_CHANNEL
from info import ADMINS, LOG_CHANNEL, FILE_STORE_CHANNEL, PUBLIC_FILE_STORE
from database.ia_filterdb import unpack_new_file_id
from utils import temp
import re
Expand All @@ -13,7 +13,14 @@
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

@Client.on_message(filters.command(['link', 'plink']))
async def allowed(_, __, message):
if PUBLIC_FILE_STORE:
return True
if message.from_user and message.from_user.id in ADMINS:
return True
return False

@Client.on_message(filters.command(['link', 'plink']) & filters.create(allowed))
async def gen_link_s(bot, message):
replied = message.reply_to_message
if not replied:
Expand All @@ -30,7 +37,7 @@ async def gen_link_s(bot, message):
await message.reply(f"Here is your Link:\nhttps://t.me/{temp.U_NAME}?start={outstr}")


@Client.on_message(filters.command(['batch', 'pbatch']))
@Client.on_message(filters.command(['batch', 'pbatch']) & filters.create(allowed))
async def gen_link_batch(bot, message):
if " " not in message.text:
return await message.reply("Use correct format.\nExample <code>/batch https://t.me/TeamEvamaria/10 https://t.me/TeamEvamaria/20</code>.")
Expand Down

0 comments on commit f6d1056

Please sign in to comment.