mirror of
https://github.com/TheCaduceus/FileStreamBot.git
synced 2026-01-15 16:33:25 -03:00
Bump to v1.8
This commit is contained in:
@@ -5,15 +5,15 @@ from .config import Telegram, LOGGER_CONFIG_JSON
|
||||
|
||||
dictConfig(LOGGER_CONFIG_JSON)
|
||||
|
||||
version = 1.7
|
||||
version = 1.8
|
||||
logger = getLogger('bot')
|
||||
|
||||
TelegramBot = Client(
|
||||
name ='bot',
|
||||
name = 'bot',
|
||||
api_id = Telegram.API_ID,
|
||||
api_hash = Telegram.API_HASH,
|
||||
bot_token = Telegram.BOT_TOKEN,
|
||||
plugins = {'root': 'bot/plugins'},
|
||||
workers = Telegram.BOT_WORKERS,
|
||||
max_concurrent_transmissions = 1000
|
||||
sleep_threshold = -1,
|
||||
max_concurrent_transmissions = 10,
|
||||
)
|
||||
|
||||
@@ -7,7 +7,6 @@ class Telegram:
|
||||
ALLOWED_USER_IDS = env.get("ALLOWED_USER_IDS", "").split()
|
||||
BOT_USERNAME = env.get("TELEGRAM_BOT_USERNAME", "BotFather")
|
||||
BOT_TOKEN = env.get("TELEGRAM_BOT_TOKEN", "1234567:xyz")
|
||||
BOT_WORKERS = env.get("BOT_WORKERS", 10)
|
||||
CHANNEL_ID = int(env.get("TELEGRAM_CHANNEL_ID", -100123456789))
|
||||
SECRET_CODE_LENGTH = int(env.get("SECRET_CODE_LENGTH", 24))
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from hydrogram import Client
|
||||
from hydrogram.types import Message, CallbackQuery
|
||||
from hydrogram.types import Message, CallbackQuery, InlineKeyboardMarkup, InlineKeyboardButton
|
||||
from typing import Union, Callable
|
||||
from functools import wraps
|
||||
from bot.config import Telegram
|
||||
from bot.modules.static import *
|
||||
|
||||
def verify_user(func: Callable):
|
||||
|
||||
@@ -12,5 +13,13 @@ def verify_user(func: Callable):
|
||||
|
||||
if not Telegram.ALLOWED_USER_IDS or chat_id in Telegram.ALLOWED_USER_IDS:
|
||||
return await func(client, update)
|
||||
elif isinstance(update, CallbackQuery):
|
||||
return await update.answer(UserNotInAllowedList, show_alert=True)
|
||||
elif isinstance(update, Message):
|
||||
return await update.reply(
|
||||
text = UserNotInAllowedList,
|
||||
quote = True,
|
||||
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton('Deploy Own', url='https://github.com/TheCaduceus/FileStreamBot')]])
|
||||
)
|
||||
|
||||
return decorator
|
||||
|
||||
@@ -1,11 +1,30 @@
|
||||
WelcomeText = \
|
||||
"""
|
||||
"""\
|
||||
Hi **%(first_name)s**, send me a file to instantly generate file links.
|
||||
|
||||
**Commands:**
|
||||
/privacy - View bot's privacy policy.
|
||||
/log - Get bot's log file. (owner only)
|
||||
/help - Show this message.
|
||||
"""
|
||||
|
||||
PrivacyText = \
|
||||
"""
|
||||
This bot securely stores your files to deliver its service.
|
||||
**Privacy Policy**
|
||||
|
||||
**1.Data Storage:** Files you upload/send are securely saved in the bot's private Telegram channel.
|
||||
|
||||
**2.Download Links:** Links include a secret code to prevent unauthorized access.
|
||||
|
||||
**3.User Control:** You can revoke links anytime using the "Revoke" button.
|
||||
|
||||
**4.Moderation:** The bot owner can view and delete your files if necessary.
|
||||
|
||||
**5.Open Source:** The bot is [open source](https://github.com/TheCaduceus/FileStreamBot). Deploy your own instance for maximum privacy.
|
||||
|
||||
**6.Retention:** Files are stored until you revoke their links.
|
||||
|
||||
__By using this bot, you agree to this policy.__
|
||||
"""
|
||||
|
||||
FileLinksText = \
|
||||
@@ -41,3 +60,8 @@ InvalidPayloadText = \
|
||||
"""
|
||||
Invalid payload.
|
||||
"""
|
||||
|
||||
UserNotInAllowedList = \
|
||||
"""
|
||||
You are not allowed to use this bot.
|
||||
"""
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from hydrogram import filters
|
||||
from hydrogram.types import Message
|
||||
from bot import TelegramBot
|
||||
from bot.config import Telegram
|
||||
from bot.modules.static import *
|
||||
from bot.modules.decorators import verify_user
|
||||
|
||||
@@ -8,11 +9,15 @@ from bot.modules.decorators import verify_user
|
||||
@verify_user
|
||||
async def start_command(_, msg: Message):
|
||||
await msg.reply(
|
||||
text=WelcomeText % {'first_name': msg.from_user.first_name},
|
||||
quote=True
|
||||
text = WelcomeText % {'first_name': msg.from_user.first_name},
|
||||
quote = True
|
||||
)
|
||||
|
||||
@TelegramBot.on_message(filters.command('privacy') & filters.private)
|
||||
@verify_user
|
||||
async def privacy_command(_, msg: Message):
|
||||
await msg.reply(text=PrivacyText, quote=True)
|
||||
await msg.reply(text=PrivacyText, quote=True, disable_web_page_preview=True)
|
||||
|
||||
@TelegramBot.on_message(filters.command('log') & filters.chat(Telegram.OWNER_ID))
|
||||
async def log_command(_, msg: Message):
|
||||
await msg.reply_document('event-log.txt', quote=True)
|
||||
|
||||
Reference in New Issue
Block a user