mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 09:44:50 +00:00
Refactor authorized user
This commit is contained in:
parent
cd5ab46fb8
commit
b3c8baa870
19 changed files with 79 additions and 80 deletions
4
app.json
4
app.json
|
|
@ -37,6 +37,10 @@
|
||||||
"description": "Allowed user in to use sudo command.",
|
"description": "Allowed user in to use sudo command.",
|
||||||
"value": ""
|
"value": ""
|
||||||
},
|
},
|
||||||
|
"OWNER_ID": {
|
||||||
|
"description": "OWNER OF THIS BOT.",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
"GOOGLE_AI_KEY": {
|
"GOOGLE_AI_KEY": {
|
||||||
"description": "Your Gemini AI Key",
|
"description": "Your Gemini AI Key",
|
||||||
"value": "",
|
"value": "",
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ from datetime import datetime
|
||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
from database import dbname
|
from database import dbname
|
||||||
from misskaty.vars import SUDO
|
from misskaty.vars import SUDO, OWNER_ID
|
||||||
|
|
||||||
fedsdb = dbname["federation"]
|
fedsdb = dbname["federation"]
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ async def is_user_fed_owner(fed_id, user_id: int):
|
||||||
if not getfed:
|
if not getfed:
|
||||||
return False
|
return False
|
||||||
owner_id = getfed["owner_id"]
|
owner_id = getfed["owner_id"]
|
||||||
return user_id == owner_id or user_id not in SUDO
|
return user_id == owner_id or user_id not in SUDO or user_id != OWNER_ID
|
||||||
|
|
||||||
|
|
||||||
async def search_fed_by_id(fed_id):
|
async def search_fed_by_id(fed_id):
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ from misskaty import (
|
||||||
)
|
)
|
||||||
from misskaty.plugins import ALL_MODULES
|
from misskaty.plugins import ALL_MODULES
|
||||||
from misskaty.plugins.web_scraper import web
|
from misskaty.plugins.web_scraper import web
|
||||||
from misskaty.vars import SUDO, USER_SESSION
|
from misskaty.vars import OWNER_ID, USER_SESSION
|
||||||
from utils import auto_clean
|
from utils import auto_clean
|
||||||
|
|
||||||
LOGGER = getLogger("MissKaty")
|
LOGGER = getLogger("MissKaty")
|
||||||
|
|
@ -59,17 +59,11 @@ async def start_bot():
|
||||||
LOGGER.info("[INFO]: BOT STARTED AS @%s!", BOT_USERNAME)
|
LOGGER.info("[INFO]: BOT STARTED AS @%s!", BOT_USERNAME)
|
||||||
try:
|
try:
|
||||||
LOGGER.info("[INFO]: SENDING ONLINE STATUS")
|
LOGGER.info("[INFO]: SENDING ONLINE STATUS")
|
||||||
for i in SUDO:
|
if USER_SESSION:
|
||||||
if USER_SESSION:
|
await app.send_message(
|
||||||
await app.send_message(
|
OWNER_ID,
|
||||||
i,
|
f"USERBOT AND BOT STARTED with Pyrogram v{__version__}..\nUserBot: {UBOT_NAME}\nBot: {BOT_NAME}\n\nwith Pyrogram v{__version__} (Layer {layer}) started on @{BOT_USERNAME}.\n\n<code>{bot_modules}</code>",
|
||||||
f"USERBOT AND BOT STARTED with Pyrogram v{__version__}..\nUserBot: {UBOT_NAME}\nBot: {BOT_NAME}\n\nwith Pyrogram v{__version__} (Layer {layer}) started on @{BOT_USERNAME}.\n\n<code>{bot_modules}</code>",
|
)
|
||||||
)
|
|
||||||
else:
|
|
||||||
await app.send_message(
|
|
||||||
i,
|
|
||||||
f"BOT STARTED with Pyrogram v{__version__} as {BOT_NAME}\n\nwith Pyrogram v{__version__} (Layer {layer}) started on @{BOT_USERNAME}.\n\n<code>{bot_modules}</code>",
|
|
||||||
)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOGGER.error(str(e))
|
LOGGER.error(str(e))
|
||||||
scheduler.start()
|
scheduler.start()
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ from pyrogram.types import CallbackQuery, Message
|
||||||
|
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
from misskaty.helper.sqlite_helper import Cache
|
from misskaty.helper.sqlite_helper import Cache
|
||||||
from misskaty.vars import SUDO
|
from misskaty.vars import SUDO, OWNER_ID
|
||||||
|
|
||||||
from ...helper.localization import (
|
from ...helper.localization import (
|
||||||
default_language,
|
default_language,
|
||||||
|
|
@ -165,7 +165,7 @@ def adminsOnly(permission):
|
||||||
# For admins and sudo users
|
# For admins and sudo users
|
||||||
userID = message.from_user.id
|
userID = message.from_user.id
|
||||||
permissions = await member_permissions(chatID, userID)
|
permissions = await member_permissions(chatID, userID)
|
||||||
if userID not in SUDO and permission not in permissions:
|
if userID not in SUDO or userID != OWNER_ID and permission not in permissions:
|
||||||
return await unauthorised(message, permission, subFunc2)
|
return await unauthorised(message, permission, subFunc2)
|
||||||
return await authorised(func, subFunc2, client, message, *args, **kwargs)
|
return await authorised(func, subFunc2, client, message, *args, **kwargs)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import asyncio
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.errors import MessageDeleteForbidden
|
from pyrogram.errors import MessageDeleteForbidden
|
||||||
|
|
||||||
from misskaty.vars import SUDO
|
from misskaty.vars import SUDO, OWNER_ID
|
||||||
|
|
||||||
data = {}
|
data = {}
|
||||||
|
|
||||||
|
|
@ -28,7 +28,7 @@ async def task(msg, warn=False, sec=None):
|
||||||
def wait(sec):
|
def wait(sec):
|
||||||
async def ___(flt, _, msg):
|
async def ___(flt, _, msg):
|
||||||
user_id = msg.from_user.id if msg.from_user else msg.sender_chat.id
|
user_id = msg.from_user.id if msg.from_user else msg.sender_chat.id
|
||||||
if user_id in SUDO:
|
if user_id in SUDO or user_id == OWNER_ID:
|
||||||
return True
|
return True
|
||||||
if user_id in data:
|
if user_id in data:
|
||||||
if msg.date.timestamp() >= data[user_id]["timestamp"] + flt.data:
|
if msg.date.timestamp() >= data[user_id]["timestamp"] + flt.data:
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ from misskaty.helper.functions import (
|
||||||
time_converter,
|
time_converter,
|
||||||
)
|
)
|
||||||
from misskaty.helper.localization import use_chat_lang
|
from misskaty.helper.localization import use_chat_lang
|
||||||
from misskaty.vars import COMMAND_HANDLER, SUDO
|
from misskaty.vars import COMMAND_HANDLER, SUDO, OWNER_ID
|
||||||
|
|
||||||
LOGGER = getLogger("MissKaty")
|
LOGGER = getLogger("MissKaty")
|
||||||
|
|
||||||
|
|
@ -172,7 +172,7 @@ async def kickFunc(client: Client, ctx: Message, strings) -> "Message":
|
||||||
return await ctx.reply_msg(strings("user_not_found"))
|
return await ctx.reply_msg(strings("user_not_found"))
|
||||||
if user_id == client.me.id:
|
if user_id == client.me.id:
|
||||||
return await ctx.reply_msg(strings("kick_self_err"))
|
return await ctx.reply_msg(strings("kick_self_err"))
|
||||||
if user_id in SUDO:
|
if user_id in SUDO or user_id == OWNER_ID:
|
||||||
return await ctx.reply_msg(strings("kick_sudo_err"))
|
return await ctx.reply_msg(strings("kick_sudo_err"))
|
||||||
if user_id in (await list_admins(ctx.chat.id)):
|
if user_id in (await list_admins(ctx.chat.id)):
|
||||||
return await ctx.reply_msg(strings("kick_admin_err"))
|
return await ctx.reply_msg(strings("kick_admin_err"))
|
||||||
|
|
@ -213,7 +213,7 @@ async def banFunc(client, message, strings):
|
||||||
return await message.reply_text(strings("user_not_found"))
|
return await message.reply_text(strings("user_not_found"))
|
||||||
if user_id == client.me.id:
|
if user_id == client.me.id:
|
||||||
return await message.reply_text(strings("ban_self_err"))
|
return await message.reply_text(strings("ban_self_err"))
|
||||||
if user_id in SUDO:
|
if user_id in SUDO or user_id == OWNER_ID:
|
||||||
return await message.reply_text(strings("ban_sudo_err"))
|
return await message.reply_text(strings("ban_sudo_err"))
|
||||||
if user_id in (await list_admins(message.chat.id)):
|
if user_id in (await list_admins(message.chat.id)):
|
||||||
return await message.reply_text(strings("ban_admin_err"))
|
return await message.reply_text(strings("ban_admin_err"))
|
||||||
|
|
@ -299,7 +299,7 @@ async def unban_func(_, message, strings):
|
||||||
|
|
||||||
# Ban users listed in a message
|
# Ban users listed in a message
|
||||||
@app.on_message(
|
@app.on_message(
|
||||||
filters.user(SUDO) & filters.command("listban", COMMAND_HANDLER) & filters.group
|
(filters.user(SUDO) | filters.user(OWNER_ID)) & filters.command("listban", COMMAND_HANDLER) & filters.group
|
||||||
)
|
)
|
||||||
@use_chat_lang()
|
@use_chat_lang()
|
||||||
async def list_ban_(c, message, strings):
|
async def list_ban_(c, message, strings):
|
||||||
|
|
@ -319,7 +319,7 @@ async def list_ban_(c, message, strings):
|
||||||
|
|
||||||
if userid == c.me.id:
|
if userid == c.me.id:
|
||||||
return await message.reply_text(strings("ban_self_err"))
|
return await message.reply_text(strings("ban_self_err"))
|
||||||
if userid in SUDO:
|
if userid in SUDO or user_id == OWNER_ID:
|
||||||
return await message.reply_text(strings("ban_sudo_err"))
|
return await message.reply_text(strings("ban_sudo_err"))
|
||||||
splitted = messagelink.split("/")
|
splitted = messagelink.split("/")
|
||||||
uname, mid = splitted[-2], int(splitted[-1])
|
uname, mid = splitted[-2], int(splitted[-1])
|
||||||
|
|
@ -353,7 +353,7 @@ async def list_ban_(c, message, strings):
|
||||||
|
|
||||||
# Unban users listed in a message
|
# Unban users listed in a message
|
||||||
@app.on_message(
|
@app.on_message(
|
||||||
filters.user(SUDO) & filters.command("listunban", COMMAND_HANDLER) & filters.group
|
(filters.user(SUDO) | filters.user(OWNER_ID)) & filters.command("listunban", COMMAND_HANDLER) & filters.group
|
||||||
)
|
)
|
||||||
@use_chat_lang()
|
@use_chat_lang()
|
||||||
async def list_unban(_, message, strings):
|
async def list_unban(_, message, strings):
|
||||||
|
|
@ -469,7 +469,7 @@ async def demote(client, message, strings):
|
||||||
return await message.reply_text(strings("user_not_found"))
|
return await message.reply_text(strings("user_not_found"))
|
||||||
if user_id == client.me.id:
|
if user_id == client.me.id:
|
||||||
return await message.reply_text(strings("demote_self_err"))
|
return await message.reply_text(strings("demote_self_err"))
|
||||||
if user_id in SUDO:
|
if user_id in SUDO or user_id == OWNER_ID:
|
||||||
return await message.reply_text(strings("demote_sudo_err"))
|
return await message.reply_text(strings("demote_sudo_err"))
|
||||||
try:
|
try:
|
||||||
await message.chat.promote_member(
|
await message.chat.promote_member(
|
||||||
|
|
@ -535,7 +535,7 @@ async def mute(client, message, strings):
|
||||||
return await message.reply_text(strings("user_not_found"))
|
return await message.reply_text(strings("user_not_found"))
|
||||||
if user_id == client.me.id:
|
if user_id == client.me.id:
|
||||||
return await message.reply_text(strings("mute_self_err"))
|
return await message.reply_text(strings("mute_self_err"))
|
||||||
if user_id in SUDO:
|
if user_id in SUDO or user_id == OWNER_ID:
|
||||||
return await message.reply_text(strings("mute_sudo_err"))
|
return await message.reply_text(strings("mute_sudo_err"))
|
||||||
if user_id in (await list_admins(message.chat.id)):
|
if user_id in (await list_admins(message.chat.id)):
|
||||||
return await message.reply_text(strings("mute_admin_err"))
|
return await message.reply_text(strings("mute_admin_err"))
|
||||||
|
|
@ -606,7 +606,7 @@ async def warn_user(client, message, strings):
|
||||||
return await message.reply_text(strings("user_not_found"))
|
return await message.reply_text(strings("user_not_found"))
|
||||||
if user_id == client.me.id:
|
if user_id == client.me.id:
|
||||||
return await message.reply_text(strings("warn_self_err"))
|
return await message.reply_text(strings("warn_self_err"))
|
||||||
if user_id in SUDO:
|
if user_id in SUDO or user_id == OWNER_ID:
|
||||||
return await message.reply_text(strings("warn_sudo_err"))
|
return await message.reply_text(strings("warn_sudo_err"))
|
||||||
if user_id in (await list_admins(chat_id)):
|
if user_id in (await list_admins(chat_id)):
|
||||||
return await message.reply_text(strings("warn_admin_err"))
|
return await message.reply_text(strings("warn_admin_err"))
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ from pyrogram.types import (
|
||||||
from database import dbname
|
from database import dbname
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
from misskaty.core.decorator.permissions import adminsOnly, member_permissions
|
from misskaty.core.decorator.permissions import adminsOnly, member_permissions
|
||||||
from misskaty.vars import COMMAND_HANDLER, SUDO
|
from misskaty.vars import COMMAND_HANDLER, SUDO, OWNER_ID
|
||||||
|
|
||||||
approvaldb = dbname["autoapprove"]
|
approvaldb = dbname["autoapprove"]
|
||||||
|
|
||||||
|
|
@ -53,7 +53,7 @@ async def approval_cb(_, cb: CallbackQuery):
|
||||||
permissions = await member_permissions(chat_id, from_user.id)
|
permissions = await member_permissions(chat_id, from_user.id)
|
||||||
permission = "can_restrict_members"
|
permission = "can_restrict_members"
|
||||||
if permission not in permissions:
|
if permission not in permissions:
|
||||||
if from_user.id not in SUDO:
|
if from_user.id not in SUDO or from_user.id != OWNER_ID:
|
||||||
return await cb.answer(
|
return await cb.answer(
|
||||||
f"You don't have the required permission.\n Permission: {permission}",
|
f"You don't have the required permission.\n Permission: {permission}",
|
||||||
show_alert=True,
|
show_alert=True,
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
|
||||||
from database.users_chats_db import db
|
from database.users_chats_db import db
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
from misskaty.helper.localization import use_chat_lang
|
from misskaty.helper.localization import use_chat_lang
|
||||||
from misskaty.vars import COMMAND_HANDLER, LOG_CHANNEL, SUDO, SUPPORT_CHAT
|
from misskaty.vars import COMMAND_HANDLER, LOG_CHANNEL, SUDO, OWNER_ID, SUPPORT_CHAT
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.incoming & filters.private, group=-5)
|
@app.on_message(filters.incoming & filters.private, group=-5)
|
||||||
|
|
@ -62,7 +62,7 @@ async def grp_bd(self: Client, ctx: Message, strings):
|
||||||
await ctx.stop_propagation()
|
await ctx.stop_propagation()
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command("banuser", COMMAND_HANDLER) & filters.user(SUDO))
|
@app.on_message(filters.command("banuser", COMMAND_HANDLER) & (filters.user(SUDO) | filters.user(OWNER_ID)))
|
||||||
async def ban_a_user(bot, message):
|
async def ban_a_user(bot, message):
|
||||||
if len(message.command) == 1:
|
if len(message.command) == 1:
|
||||||
return await message.reply("Give me a user id / username")
|
return await message.reply("Give me a user id / username")
|
||||||
|
|
@ -99,7 +99,7 @@ async def ban_a_user(bot, message):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command("unbanuser", COMMAND_HANDLER) & filters.user(SUDO))
|
@app.on_message(filters.command("unbanuser", COMMAND_HANDLER) & (filters.user(SUDO) | filters.user(OWNER_ID)))
|
||||||
async def unban_a_user(bot, message):
|
async def unban_a_user(bot, message):
|
||||||
if len(message.command) == 1:
|
if len(message.command) == 1:
|
||||||
return await message.reply("Give me a user id / username")
|
return await message.reply("Give me a user id / username")
|
||||||
|
|
@ -127,7 +127,7 @@ async def unban_a_user(bot, message):
|
||||||
await message.reply(f"Successfully unbanned user {k.mention}!!!")
|
await message.reply(f"Successfully unbanned user {k.mention}!!!")
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command("disablechat", COMMAND_HANDLER) & filters.user(SUDO))
|
@app.on_message(filters.command("disablechat", COMMAND_HANDLER) & (filters.user(SUDO) | filters.user(OWNER_ID)))
|
||||||
async def disable_chat(bot, message):
|
async def disable_chat(bot, message):
|
||||||
if len(message.command) == 1:
|
if len(message.command) == 1:
|
||||||
return await message.reply("Give me a chat id")
|
return await message.reply("Give me a chat id")
|
||||||
|
|
@ -166,7 +166,7 @@ async def disable_chat(bot, message):
|
||||||
await message.reply(f"Error - {e}")
|
await message.reply(f"Error - {e}")
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command("enablechat", COMMAND_HANDLER) & filters.user(SUDO))
|
@app.on_message(filters.command("enablechat", COMMAND_HANDLER) & (filters.user(SUDO) | filters.user(OWNER_ID)))
|
||||||
async def re_enable_chat(_, ctx: Message):
|
async def re_enable_chat(_, ctx: Message):
|
||||||
if len(ctx.command) == 1:
|
if len(ctx.command) == 1:
|
||||||
return await ctx.reply("Give me a chat id")
|
return await ctx.reply("Give me a chat id")
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ from database.blacklist_db import (
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
from misskaty.core.decorator.errors import capture_err
|
from misskaty.core.decorator.errors import capture_err
|
||||||
from misskaty.core.decorator.permissions import adminsOnly, list_admins
|
from misskaty.core.decorator.permissions import adminsOnly, list_admins
|
||||||
from misskaty.vars import SUDO
|
from misskaty.vars import SUDO, OWNER_ID
|
||||||
|
|
||||||
__MODULE__ = "Blacklist"
|
__MODULE__ = "Blacklist"
|
||||||
__HELP__ = """
|
__HELP__ = """
|
||||||
|
|
@ -98,7 +98,7 @@ async def blacklist_filters_re(self, message):
|
||||||
user = message.from_user
|
user = message.from_user
|
||||||
if not user:
|
if not user:
|
||||||
return
|
return
|
||||||
if user.id in SUDO:
|
if user.id in SUDO or user.id == OWNER_ID:
|
||||||
return
|
return
|
||||||
list_of_filters = await get_blacklisted_words(chat_id)
|
list_of_filters = await get_blacklisted_words(chat_id)
|
||||||
for word in list_of_filters:
|
for word in list_of_filters:
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,11 @@ from pyrogram import filters
|
||||||
from pyrogram.types import Message
|
from pyrogram.types import Message
|
||||||
|
|
||||||
from misskaty import DATABASE_URI, app
|
from misskaty import DATABASE_URI, app
|
||||||
from misskaty.vars import SUDO
|
from misskaty.vars import OWNER_ID
|
||||||
from utils import broadcast_messages
|
from utils import broadcast_messages
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command("broadcast") & filters.user(SUDO) & filters.reply)
|
@app.on_message(filters.command("broadcast") & filters.user(OWNER_ID) & filters.reply)
|
||||||
async def broadcast(_, ctx: Message):
|
async def broadcast(_, ctx: Message):
|
||||||
mongo = AsyncClient(DATABASE_URI)
|
mongo = AsyncClient(DATABASE_URI)
|
||||||
userdb = mongo["MissKatyBot"]["peers"]
|
userdb = mongo["MissKatyBot"]["peers"]
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ from pyrogram.types import Message
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
from misskaty.core import pyro_cooldown
|
from misskaty.core import pyro_cooldown
|
||||||
from misskaty.helper import check_time_gap, post_to_telegraph, use_chat_lang
|
from misskaty.helper import check_time_gap, post_to_telegraph, use_chat_lang
|
||||||
from misskaty.vars import COMMAND_HANDLER, GOOGLEAI_KEY, OPENAI_KEY, SUDO
|
from misskaty.vars import COMMAND_HANDLER, GOOGLEAI_KEY, OPENAI_KEY, OWNER_ID
|
||||||
|
|
||||||
__MODULE__ = "ChatBot"
|
__MODULE__ = "ChatBot"
|
||||||
__HELP__ = """
|
__HELP__ = """
|
||||||
|
|
@ -123,7 +123,7 @@ async def openai_chatbot(self, ctx: Message, strings):
|
||||||
return await ctx.reply_msg("OPENAI_KEY env is missing!!!")
|
return await ctx.reply_msg("OPENAI_KEY env is missing!!!")
|
||||||
uid = ctx.from_user.id if ctx.from_user else ctx.sender_chat.id
|
uid = ctx.from_user.id if ctx.from_user else ctx.sender_chat.id
|
||||||
is_in_gap, _ = await check_time_gap(uid)
|
is_in_gap, _ = await check_time_gap(uid)
|
||||||
if is_in_gap and (uid not in SUDO):
|
if is_in_gap and (uid not == OWNER_ID):
|
||||||
return await ctx.reply_msg(strings("dont_spam"), del_in=5)
|
return await ctx.reply_msg(strings("dont_spam"), del_in=5)
|
||||||
pertanyaan = ctx.input
|
pertanyaan = ctx.input
|
||||||
msg = await ctx.reply_msg(strings("find_answers_str"), quote=True)
|
msg = await ctx.reply_msg(strings("find_answers_str"), quote=True)
|
||||||
|
|
@ -131,7 +131,7 @@ async def openai_chatbot(self, ctx: Message, strings):
|
||||||
gptai_conversations[uid] = [{"role": "system", "content": "Kamu adalah AI dengan karakter mirip kucing bernama MissKaty AI yang diciptakan oleh Yasir untuk membantu manusia mencari informasi."}, {"role": "user", "content": pertanyaan}]
|
gptai_conversations[uid] = [{"role": "system", "content": "Kamu adalah AI dengan karakter mirip kucing bernama MissKaty AI yang diciptakan oleh Yasir untuk membantu manusia mencari informasi."}, {"role": "user", "content": pertanyaan}]
|
||||||
else:
|
else:
|
||||||
gptai_conversations[uid].append({"role": "user", "content": pertanyaan})
|
gptai_conversations[uid].append({"role": "user", "content": pertanyaan})
|
||||||
ai_response = await get_openai_stream_response(True, OPENAI_KEY, "https://models.inference.ai.azure.com" if uid in SUDO else "https://duckai.yasirapi.eu.org/v1", "gpt-4o" if uid in SUDO else "gpt-4o-mini", gptai_conversations[uid], msg, strings)
|
ai_response = await get_openai_stream_response(True, OPENAI_KEY, "https://models.inference.ai.azure.com" if uid == OWNER_ID else "https://duckai.yasirapi.eu.org/v1", "gpt-4o" if uid == OWNER_ID else "gpt-4o-mini", gptai_conversations[uid], msg, strings)
|
||||||
if not ai_response:
|
if not ai_response:
|
||||||
gptai_conversations[uid].pop()
|
gptai_conversations[uid].pop()
|
||||||
if len(gptai_conversations[uid]) == 1:
|
if len(gptai_conversations[uid]) == 1:
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ from misskaty.helper.http import fetch
|
||||||
from misskaty.helper.human_read import get_readable_file_size, get_readable_time
|
from misskaty.helper.human_read import get_readable_file_size, get_readable_time
|
||||||
from misskaty.helper.localization import use_chat_lang
|
from misskaty.helper.localization import use_chat_lang
|
||||||
from database.payment_db import autopay_update
|
from database.payment_db import autopay_update
|
||||||
from misskaty.vars import AUTO_RESTART, COMMAND_HANDLER, LOG_CHANNEL, SUDO, PAYDISINI_CHANNEL_ID, PAYDISINI_KEY
|
from misskaty.vars import AUTO_RESTART, COMMAND_HANDLER, LOG_CHANNEL, SUDO, OWNER_ID PAYDISINI_CHANNEL_ID, PAYDISINI_KEY
|
||||||
|
|
||||||
__MODULE__ = "DevCommand"
|
__MODULE__ = "DevCommand"
|
||||||
__HELP__ = """
|
__HELP__ = """
|
||||||
|
|
@ -142,7 +142,7 @@ async def refund_star_payment(client: Client, message: Message):
|
||||||
await message.reply_msg(e)
|
await message.reply_msg(e)
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command(["logs"], COMMAND_HANDLER) & filters.user(SUDO))
|
@app.on_message(filters.command(["logs"], COMMAND_HANDLER) & (filters.user(SUDO) | filters.user(OWNER_ID)))
|
||||||
@use_chat_lang()
|
@use_chat_lang()
|
||||||
async def log_file(_, ctx: Message, strings):
|
async def log_file(_, ctx: Message, strings):
|
||||||
"""Send log file"""
|
"""Send log file"""
|
||||||
|
|
@ -244,7 +244,7 @@ async def donate(self: Client, ctx: Message):
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(
|
@app.on_message(
|
||||||
filters.command(["balas"], COMMAND_HANDLER) & filters.user(SUDO) & filters.reply
|
filters.command(["balas"], COMMAND_HANDLER) & (filters.user(SUDO) | filters.user(OWNER_ID)) & filters.reply
|
||||||
)
|
)
|
||||||
async def balas(_, ctx: Message) -> "str":
|
async def balas(_, ctx: Message) -> "str":
|
||||||
pesan = ctx.input
|
pesan = ctx.input
|
||||||
|
|
@ -346,7 +346,7 @@ async def server_stats(_, ctx: Message) -> "Message":
|
||||||
|
|
||||||
|
|
||||||
# Gban
|
# Gban
|
||||||
@app.on_message(filters.command("gban", COMMAND_HANDLER) & filters.user(SUDO))
|
@app.on_message(filters.command("gban", COMMAND_HANDLER) & (filters.user(SUDO) | filters.user(OWNER_ID)))
|
||||||
async def ban_globally(self: Client, ctx: Message):
|
async def ban_globally(self: Client, ctx: Message):
|
||||||
user_id, reason = await extract_user_and_reason(ctx)
|
user_id, reason = await extract_user_and_reason(ctx)
|
||||||
if not user_id:
|
if not user_id:
|
||||||
|
|
@ -364,7 +364,7 @@ async def ban_globally(self: Client, ctx: Message):
|
||||||
|
|
||||||
from_user = ctx.from_user
|
from_user = ctx.from_user
|
||||||
|
|
||||||
if user_id in [from_user.id, self.me.id] or user_id in SUDO:
|
if user_id in [from_user.id, self.me.id] or user_id in SUDO or user_id == OWNER_ID:
|
||||||
return await ctx.reply_text("I can't ban that user.")
|
return await ctx.reply_text("I can't ban that user.")
|
||||||
served_chats = await db.get_all_chats()
|
served_chats = await db.get_all_chats()
|
||||||
m = await ctx.reply_text(
|
m = await ctx.reply_text(
|
||||||
|
|
@ -412,7 +412,7 @@ __**New Global Ban**__
|
||||||
|
|
||||||
|
|
||||||
# Ungban
|
# Ungban
|
||||||
@app.on_message(filters.command("ungban", COMMAND_HANDLER) & filters.user(SUDO))
|
@app.on_message(filters.command("ungban", COMMAND_HANDLER) & (filters.user(SUDO) | filters.user(OWNER_ID)))
|
||||||
async def unban_globally(_, ctx: Message):
|
async def unban_globally(_, ctx: Message):
|
||||||
user_id = await extract_user(ctx)
|
user_id = await extract_user(ctx)
|
||||||
if not user_id:
|
if not user_id:
|
||||||
|
|
@ -434,11 +434,11 @@ async def unban_globally(_, ctx: Message):
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(
|
@app.on_message(
|
||||||
filters.command(["shell", "sh", "term"], COMMAND_HANDLER) & filters.user(SUDO)
|
filters.command(["shell", "sh", "term"], COMMAND_HANDLER) & filters.user(OWNER_ID)
|
||||||
)
|
)
|
||||||
@app.on_edited_message(
|
@app.on_edited_message(
|
||||||
filters.command(["shell", "sh", "term"], COMMAND_HANDLER)
|
filters.command(["shell", "sh", "term"], COMMAND_HANDLER)
|
||||||
& filters.user(SUDO)
|
& filters.user(OWNER_ID)
|
||||||
& ~filters.react
|
& ~filters.react
|
||||||
)
|
)
|
||||||
@user.on_message(filters.command(["shell", "sh", "term"], ".") & filters.me)
|
@user.on_message(filters.command(["shell", "sh", "term"], ".") & filters.me)
|
||||||
|
|
@ -501,14 +501,14 @@ async def shell_cmd(self: Client, ctx: Message, strings):
|
||||||
filters.command(["ev", "run", "myeval"], COMMAND_HANDLER)
|
filters.command(["ev", "run", "myeval"], COMMAND_HANDLER)
|
||||||
| filters.regex(r"app.run\(\)$")
|
| filters.regex(r"app.run\(\)$")
|
||||||
)
|
)
|
||||||
& filters.user(SUDO)
|
& filters.user(OWNER_ID)
|
||||||
)
|
)
|
||||||
@app.on_edited_message(
|
@app.on_edited_message(
|
||||||
(
|
(
|
||||||
filters.command(["ev", "run", "meval"], COMMAND_HANDLER)
|
filters.command(["ev", "run", "meval"], COMMAND_HANDLER)
|
||||||
| filters.regex(r"app.run\(\)$")
|
| filters.regex(r"app.run\(\)$")
|
||||||
)
|
)
|
||||||
& filters.user(SUDO)
|
& filters.user(OWNER_ID)
|
||||||
& ~filters.react
|
& ~filters.react
|
||||||
)
|
)
|
||||||
@user.on_message(filters.command(["ev", "run", "meval"], ".") & filters.me)
|
@user.on_message(filters.command(["ev", "run", "meval"], ".") & filters.me)
|
||||||
|
|
@ -649,7 +649,7 @@ async def cmd_eval(self: Client, ctx: Message, strings) -> Optional[str]:
|
||||||
|
|
||||||
|
|
||||||
# Update and restart bot
|
# Update and restart bot
|
||||||
@app.on_message(filters.command(["restart"], COMMAND_HANDLER) & filters.user(SUDO))
|
@app.on_message(filters.command(["restart"], COMMAND_HANDLER) & (filters.user(SUDO) | filters.user(OWNER_ID)))
|
||||||
@use_chat_lang()
|
@use_chat_lang()
|
||||||
async def update_restart(_, ctx: Message, strings):
|
async def update_restart(_, ctx: Message, strings):
|
||||||
msg = await ctx.reply_msg(strings("up_and_rest"))
|
msg = await ctx.reply_msg(strings("up_and_rest"))
|
||||||
|
|
|
||||||
|
|
@ -22,13 +22,13 @@ from misskaty import app
|
||||||
from misskaty.core.decorator import capture_err, new_task
|
from misskaty.core.decorator import capture_err, new_task
|
||||||
from misskaty.helper.http import fetch
|
from misskaty.helper.http import fetch
|
||||||
from misskaty.helper.pyro_progress import humanbytes, progress_for_pyrogram
|
from misskaty.helper.pyro_progress import humanbytes, progress_for_pyrogram
|
||||||
from misskaty.vars import COMMAND_HANDLER, SUDO
|
from misskaty.vars import COMMAND_HANDLER, OWNER_ID
|
||||||
|
|
||||||
LOGGER = getLogger("MissKaty")
|
LOGGER = getLogger("MissKaty")
|
||||||
|
|
||||||
__MODULE__ = "Download/Upload"
|
__MODULE__ = "Download/Upload"
|
||||||
__HELP__ = """
|
__HELP__ = """
|
||||||
/download [url] - Download file from URL (Sudo Only)
|
/download [url] - Download file from URL (OWNER Only)
|
||||||
/download [reply_to_TG_File] - Download TG File
|
/download [reply_to_TG_File] - Download TG File
|
||||||
/tgraph_up [reply_to_TG_File] - Download TG File
|
/tgraph_up [reply_to_TG_File] - Download TG File
|
||||||
/tiktokdl [link] - Download TikTok Video, try use ytdown command if error.
|
/tiktokdl [link] - Download TikTok Video, try use ytdown command if error.
|
||||||
|
|
@ -82,7 +82,7 @@ async def upload(bot, message):
|
||||||
os.remove(fileku)
|
os.remove(fileku)
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command(["download"], COMMAND_HANDLER) & filters.user(SUDO))
|
@app.on_message(filters.command(["download"], COMMAND_HANDLER) & filters.user(OWNER_ID))
|
||||||
@capture_err
|
@capture_err
|
||||||
@new_task
|
@new_task
|
||||||
async def download(client, message):
|
async def download(client, message):
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ from database.feds_db import *
|
||||||
from misskaty import BOT_ID, app
|
from misskaty import BOT_ID, app
|
||||||
from misskaty.core.decorator.errors import capture_err
|
from misskaty.core.decorator.errors import capture_err
|
||||||
from misskaty.helper.functions import extract_user, extract_user_and_reason
|
from misskaty.helper.functions import extract_user, extract_user_and_reason
|
||||||
from misskaty.vars import COMMAND_HANDLER, LOG_GROUP_ID, SUDO
|
from misskaty.vars import COMMAND_HANDLER, LOG_GROUP_ID, SUDO, OWNER_ID
|
||||||
|
|
||||||
__MODULE__ = "Federation"
|
__MODULE__ = "Federation"
|
||||||
__HELP__ = """
|
__HELP__ = """
|
||||||
|
|
@ -115,7 +115,7 @@ async def del_fed(client, message):
|
||||||
getinfo = await get_fed_info(is_fed_id)
|
getinfo = await get_fed_info(is_fed_id)
|
||||||
if getinfo is False:
|
if getinfo is False:
|
||||||
return await message.reply_text("This federation does not exist.")
|
return await message.reply_text("This federation does not exist.")
|
||||||
if getinfo["owner_id"] == user.id or user.id not in SUDO:
|
if getinfo["owner_id"] == user.id or user.id not in SUDO or user.id != OWNER_ID:
|
||||||
fed_id = is_fed_id
|
fed_id = is_fed_id
|
||||||
else:
|
else:
|
||||||
return await message.reply_text("Only federation owners can do this!")
|
return await message.reply_text("Only federation owners can do this!")
|
||||||
|
|
@ -298,8 +298,8 @@ async def join_fed(self, message):
|
||||||
fed_id = await get_fed_id(int(chat.id))
|
fed_id = await get_fed_id(int(chat.id))
|
||||||
|
|
||||||
if (
|
if (
|
||||||
user.id in SUDO or member.status != ChatMemberStatus.OWNER
|
user.id in SUDO or user.id == OWNER_ID or member.status != ChatMemberStatus.OWNER
|
||||||
) and user.id not in SUDO:
|
) and user.id not in SUDO and user.id != OWNER_ID:
|
||||||
return await message.reply_text("Only group creators can use this command!")
|
return await message.reply_text("Only group creators can use this command!")
|
||||||
if fed_id:
|
if fed_id:
|
||||||
return await message.reply_text("You cannot join two federations from one chat")
|
return await message.reply_text("You cannot join two federations from one chat")
|
||||||
|
|
@ -347,7 +347,7 @@ async def leave_fed(client, message):
|
||||||
fed_info = await get_fed_info(fed_id)
|
fed_info = await get_fed_info(fed_id)
|
||||||
|
|
||||||
member = await app.get_chat_member(chat.id, user.id)
|
member = await app.get_chat_member(chat.id, user.id)
|
||||||
if member.status == ChatMemberStatus.OWNER or user.id in SUDO:
|
if member.status == ChatMemberStatus.OWNER or user.id in SUDO or user.id == OWNER_ID:
|
||||||
if await chat_leave_fed(int(chat.id)) is True:
|
if await chat_leave_fed(int(chat.id)) is True:
|
||||||
if get_fedlog := fed_info["log_group_id"]:
|
if get_fedlog := fed_info["log_group_id"]:
|
||||||
await app.send_message(
|
await app.send_message(
|
||||||
|
|
@ -388,7 +388,7 @@ async def fed_chat(client, message):
|
||||||
fed_owner = info["owner_id"]
|
fed_owner = info["owner_id"]
|
||||||
fed_admins = info["fadmins"]
|
fed_admins = info["fadmins"]
|
||||||
all_admins = [fed_owner] + fed_admins + [int(BOT_ID)]
|
all_admins = [fed_owner] + fed_admins + [int(BOT_ID)]
|
||||||
if user.id not in all_admins and user.id not in SUDO:
|
if user.id not in all_admins and user.id not in SUDO and user.id != OWNER_ID:
|
||||||
return await message.reply_text(
|
return await message.reply_text(
|
||||||
"You need to be a Fed Admin to use this command"
|
"You need to be a Fed Admin to use this command"
|
||||||
)
|
)
|
||||||
|
|
@ -486,7 +486,7 @@ async def fpromote(client, message):
|
||||||
"You need to add a federation to this chat first!"
|
"You need to add a federation to this chat first!"
|
||||||
)
|
)
|
||||||
|
|
||||||
if await is_user_fed_owner(fed_id, user.id) or user.id in SUDO:
|
if await is_user_fed_owner(fed_id, user.id) or user.id in SUDO or user.id == OWNER_ID:
|
||||||
user_id = await extract_user(msg)
|
user_id = await extract_user(msg)
|
||||||
|
|
||||||
if user_id is None:
|
if user_id is None:
|
||||||
|
|
@ -545,7 +545,7 @@ async def fdemote(client, message):
|
||||||
"You need to add a federation to this chat first!"
|
"You need to add a federation to this chat first!"
|
||||||
)
|
)
|
||||||
|
|
||||||
if await is_user_fed_owner(fed_id, user.id) or user.id in SUDO:
|
if await is_user_fed_owner(fed_id, user.id) or user.id in SUDO or user.id == OWNER_ID:
|
||||||
user_id = await extract_user(msg)
|
user_id = await extract_user(msg)
|
||||||
|
|
||||||
if user_id is None:
|
if user_id is None:
|
||||||
|
|
@ -586,7 +586,7 @@ async def fban_user(client, message):
|
||||||
fed_admins = info["fadmins"]
|
fed_admins = info["fadmins"]
|
||||||
fed_owner = info["owner_id"]
|
fed_owner = info["owner_id"]
|
||||||
all_admins = [fed_owner] + fed_admins + [int(BOT_ID)]
|
all_admins = [fed_owner] + fed_admins + [int(BOT_ID)]
|
||||||
if from_user.id not in all_admins and from_user.id not in SUDO:
|
if from_user.id not in all_admins and from_user.id not in SUDO and from_user.id != OWNER_ID:
|
||||||
return await message.reply_text(
|
return await message.reply_text(
|
||||||
"You need to be a Fed Admin to use this command"
|
"You need to be a Fed Admin to use this command"
|
||||||
)
|
)
|
||||||
|
|
@ -603,7 +603,7 @@ async def fban_user(client, message):
|
||||||
)
|
)
|
||||||
if not user_id:
|
if not user_id:
|
||||||
return await message.reply_text("I can't find that user.")
|
return await message.reply_text("I can't find that user.")
|
||||||
if user_id in all_admins or user_id in SUDO:
|
if user_id in all_admins or user_id in SUDO or user_id == OWNER_ID:
|
||||||
return await message.reply_text("I can't ban that user.")
|
return await message.reply_text("I can't ban that user.")
|
||||||
check_user = await check_banned_user(fed_id, user_id)
|
check_user = await check_banned_user(fed_id, user_id)
|
||||||
if check_user:
|
if check_user:
|
||||||
|
|
@ -685,7 +685,7 @@ async def funban_user(client, message):
|
||||||
fed_admins = info["fadmins"]
|
fed_admins = info["fadmins"]
|
||||||
fed_owner = info["owner_id"]
|
fed_owner = info["owner_id"]
|
||||||
all_admins = [fed_owner] + fed_admins + [int(BOT_ID)]
|
all_admins = [fed_owner] + fed_admins + [int(BOT_ID)]
|
||||||
if from_user.id not in all_admins and from_user.id not in SUDO:
|
if from_user.id not in all_admins and from_user.id not in SUDO or from_user.id != OWNER_ID:
|
||||||
return await message.reply_text(
|
return await message.reply_text(
|
||||||
"You need to be a Fed Admin to use this command"
|
"You need to be a Fed Admin to use this command"
|
||||||
)
|
)
|
||||||
|
|
@ -697,7 +697,7 @@ async def funban_user(client, message):
|
||||||
user = await app.get_users(user_id)
|
user = await app.get_users(user_id)
|
||||||
if not user_id:
|
if not user_id:
|
||||||
return await message.reply_text("I can't find that user.")
|
return await message.reply_text("I can't find that user.")
|
||||||
if user_id in all_admins or user_id in SUDO:
|
if user_id in all_admins or user_id in SUDO or user_id == OWNER_ID:
|
||||||
return await message.reply_text("**How can an admin ever be banned!.**")
|
return await message.reply_text("**How can an admin ever be banned!.**")
|
||||||
check_user = await check_banned_user(fed_id, user_id)
|
check_user = await check_banned_user(fed_id, user_id)
|
||||||
if not check_user:
|
if not check_user:
|
||||||
|
|
@ -815,7 +815,7 @@ async def fbroadcast_message(client, message):
|
||||||
fed_owner = info["owner_id"]
|
fed_owner = info["owner_id"]
|
||||||
fed_admins = info["fadmins"]
|
fed_admins = info["fadmins"]
|
||||||
all_admins = [fed_owner] + fed_admins + [int(BOT_ID)]
|
all_admins = [fed_owner] + fed_admins + [int(BOT_ID)]
|
||||||
if from_user.id not in all_admins and from_user.id not in SUDO:
|
if from_user.id not in all_admins and from_user.id not in SUDO and from_user != OWNER_ID:
|
||||||
return await message.reply_text(
|
return await message.reply_text(
|
||||||
"You need to be a Fed Admin to use this command"
|
"You need to be a Fed Admin to use this command"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ from pyrogram.errors import MessageIdInvalid, PeerIdInvalid, ReactionInvalid
|
||||||
from misskaty import app, user
|
from misskaty import app, user
|
||||||
from misskaty.core.decorator.errors import capture_err
|
from misskaty.core.decorator.errors import capture_err
|
||||||
from misskaty.helper.localization import use_chat_lang
|
from misskaty.helper.localization import use_chat_lang
|
||||||
from misskaty.vars import COMMAND_HANDLER, SUDO
|
from misskaty.vars import COMMAND_HANDLER, SUDO, OWNER_ID
|
||||||
|
|
||||||
|
|
||||||
async def draw_meme_text(image_path, text):
|
async def draw_meme_text(image_path, text):
|
||||||
|
|
@ -197,7 +197,7 @@ async def beriharapan(c, m):
|
||||||
await reply.reply(f"{sender_name} memberikan {pesan} pada {reply_name}")
|
await reply.reply(f"{sender_name} memberikan {pesan} pada {reply_name}")
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command("react", COMMAND_HANDLER) & filters.user(SUDO))
|
@app.on_message(filters.command("react", COMMAND_HANDLER) & (filters.user(SUDO) | filters.user(OWNER_ID)))
|
||||||
@user.on_message(filters.command("react", "."))
|
@user.on_message(filters.command("react", "."))
|
||||||
async def givereact(c, m):
|
async def givereact(c, m):
|
||||||
if len(m.command) == 1:
|
if len(m.command) == 1:
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ from database.users_chats_db import db
|
||||||
from misskaty import BOT_USERNAME, app
|
from misskaty import BOT_USERNAME, app
|
||||||
from misskaty.core.decorator import asyncify, capture_err
|
from misskaty.core.decorator import asyncify, capture_err
|
||||||
from misskaty.helper import fetch, use_chat_lang
|
from misskaty.helper import fetch, use_chat_lang
|
||||||
from misskaty.vars import COMMAND_HANDLER, SUDO, SUPPORT_CHAT
|
from misskaty.vars import COMMAND_HANDLER, SUPPORT_CHAT, OWNER_ID
|
||||||
from utils import temp
|
from utils import temp
|
||||||
|
|
||||||
LOGGER = getLogger("MissKaty")
|
LOGGER = getLogger("MissKaty")
|
||||||
|
|
@ -105,7 +105,7 @@ async def member_has_joined(c: Client, member: ChatMemberUpdated, strings):
|
||||||
if not await is_welcome(member.chat.id):
|
if not await is_welcome(member.chat.id):
|
||||||
return
|
return
|
||||||
user = member.new_chat_member.user if member.new_chat_member else member.from_user
|
user = member.new_chat_member.user if member.new_chat_member else member.from_user
|
||||||
if user.id in SUDO:
|
if user.id == OWNER_ID:
|
||||||
await c.send_message(
|
await c.send_message(
|
||||||
member.chat.id,
|
member.chat.id,
|
||||||
strings("sudo_join_msg"),
|
strings("sudo_join_msg"),
|
||||||
|
|
@ -178,7 +178,7 @@ async def welcome_toggle_handler(client, message):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command("leave") & filters.user(SUDO))
|
@app.on_message(filters.command("leave") & filters.user(OWNER_ID))
|
||||||
async def leave_a_chat(bot, message):
|
async def leave_a_chat(bot, message):
|
||||||
if len(message.command) == 1:
|
if len(message.command) == 1:
|
||||||
return await message.reply("Give me a chat id")
|
return await message.reply("Give me a chat id")
|
||||||
|
|
@ -204,7 +204,7 @@ async def leave_a_chat(bot, message):
|
||||||
|
|
||||||
|
|
||||||
# Not to be used
|
# Not to be used
|
||||||
# @app.on_message(filters.command('invite') & filters.user(SUDO))
|
# @app.on_message(filters.command('invite') & filters.user(OWNER_ID))
|
||||||
async def gen_invite(bot, message):
|
async def gen_invite(bot, message):
|
||||||
if len(message.command) == 1:
|
if len(message.command) == 1:
|
||||||
return await message.reply("Give me a chat id")
|
return await message.reply("Give me a chat id")
|
||||||
|
|
@ -266,7 +266,7 @@ async def kickme(_, message):
|
||||||
await message.reply(f"ERROR: {err}")
|
await message.reply(f"ERROR: {err}")
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command("users") & filters.user(SUDO))
|
@app.on_message(filters.command("users") & filters.user(OWNER_ID))
|
||||||
async def list_users(_, message):
|
async def list_users(_, message):
|
||||||
# https://t.me/GetTGLink/4184
|
# https://t.me/GetTGLink/4184
|
||||||
msg = await message.reply("Getting List Of Users")
|
msg = await message.reply("Getting List Of Users")
|
||||||
|
|
@ -286,7 +286,7 @@ async def list_users(_, message):
|
||||||
await msg.delete_msg()
|
await msg.delete_msg()
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command("chats") & filters.user(SUDO))
|
@app.on_message(filters.command("chats") & filters.user(OWNER_ID))
|
||||||
async def list_chats(_, message):
|
async def list_chats(_, message):
|
||||||
msg = await message.reply("Getting List Of chats")
|
msg = await message.reply("Getting List Of chats")
|
||||||
chats = await db.get_all_chats()
|
chats = await db.get_all_chats()
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ from misskaty import app
|
||||||
from misskaty.core.decorator.errors import capture_err
|
from misskaty.core.decorator.errors import capture_err
|
||||||
from misskaty.core.decorator.permissions import adminsOnly, list_admins
|
from misskaty.core.decorator.permissions import adminsOnly, list_admins
|
||||||
from misskaty.helper.functions import get_urls_from_text
|
from misskaty.helper.functions import get_urls_from_text
|
||||||
from misskaty.vars import COMMAND_HANDLER, SUDO
|
from misskaty.vars import COMMAND_HANDLER, SUDO, OWNER_ID
|
||||||
|
|
||||||
LOGGER = getLogger("MissKaty")
|
LOGGER = getLogger("MissKaty")
|
||||||
|
|
||||||
|
|
@ -209,7 +209,7 @@ async def url_detector(_, message):
|
||||||
if not text or not user:
|
if not text or not user:
|
||||||
return
|
return
|
||||||
mods = await list_admins(chat_id)
|
mods = await list_admins(chat_id)
|
||||||
if user.id in mods or user.id in SUDO:
|
if user.id in mods or user.id in SUDO or user.id == OWNER_ID:
|
||||||
return
|
return
|
||||||
|
|
||||||
if get_urls_from_text(text):
|
if get_urls_from_text(text):
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ from misskaty import app
|
||||||
from misskaty.core import pyro_cooldown
|
from misskaty.core import pyro_cooldown
|
||||||
from misskaty.core.decorator import capture_err, new_task
|
from misskaty.core.decorator import capture_err, new_task
|
||||||
from misskaty.helper import fetch, isValidURL, use_chat_lang
|
from misskaty.helper import fetch, isValidURL, use_chat_lang
|
||||||
from misskaty.vars import COMMAND_HANDLER, LOG_CHANNEL, SUDO
|
from misskaty.vars import COMMAND_HANDLER, LOG_CHANNEL, SUDO, OWNER_ID
|
||||||
|
|
||||||
LOGGER = getLogger("MissKaty")
|
LOGGER = getLogger("MissKaty")
|
||||||
YT_REGEX = r"^(https?://)?(www\.)?(youtube|youtu|youtube-nocookie)\.(com|be)/(watch\?v=|embed/|v/|.+\?v=)?(?P<id>[A-Za-z0-9\-=_]{11})"
|
YT_REGEX = r"^(https?://)?(www\.)?(youtube|youtu|youtube-nocookie)\.(com|be)/(watch\?v=|embed/|v/|.+\?v=)?(?P<id>[A-Za-z0-9\-=_]{11})"
|
||||||
|
|
@ -198,7 +198,7 @@ async def ytdl_gendl_callback(self: Client, cq: CallbackQuery, strings):
|
||||||
return await cq.answer(strings("unauth"), True)
|
return await cq.answer(strings("unauth"), True)
|
||||||
except QueryIdInvalid:
|
except QueryIdInvalid:
|
||||||
return
|
return
|
||||||
if match[2] in ["mkv", "mp4"] and cq.from_user.id not in SUDO:
|
if match[2] in ["mkv", "mp4"] and cq.from_user.id not in SUDO and and cq.from_user.id == OWNER_ID:
|
||||||
try:
|
try:
|
||||||
return await cq.answer(strings("vip-btn"), True)
|
return await cq.answer(strings("vip-btn"), True)
|
||||||
except QueryIdInvalid:
|
except QueryIdInvalid:
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ SUDO = list(
|
||||||
).split()
|
).split()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
OWNER_ID = int(environ.get("OWNER_ID", 2024984460))
|
||||||
SUPPORT_CHAT = environ.get("SUPPORT_CHAT", "YasirPediaChannel")
|
SUPPORT_CHAT = environ.get("SUPPORT_CHAT", "YasirPediaChannel")
|
||||||
AUTO_RESTART = environ.get("AUTO_RESTART", False)
|
AUTO_RESTART = environ.get("AUTO_RESTART", False)
|
||||||
OPENAI_KEY = environ.get("OPENAI_KEY")
|
OPENAI_KEY = environ.get("OPENAI_KEY")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue