Compare commits
3 Commits
da3dd3a2fe
...
717d636497
Author | SHA1 | Date | |
---|---|---|---|
717d636497 | |||
64b0562bc4 | |||
eced1b7984 |
@@ -114,7 +114,6 @@
|
|||||||
"permissions": [
|
"permissions": [
|
||||||
"users",
|
"users",
|
||||||
"admins",
|
"admins",
|
||||||
"group_users",
|
|
||||||
"group_admins"
|
"group_admins"
|
||||||
],
|
],
|
||||||
"modules": [
|
"modules": [
|
||||||
@@ -123,7 +122,7 @@
|
|||||||
},
|
},
|
||||||
"warn": {
|
"warn": {
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"group_users"
|
"group_users_admins"
|
||||||
],
|
],
|
||||||
"modules": [
|
"modules": [
|
||||||
"warnings"
|
"warnings"
|
||||||
|
@@ -3,6 +3,7 @@ from pyrogram import filters
|
|||||||
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, Message
|
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, Message
|
||||||
from pyrogram.client import Client
|
from pyrogram.client import Client
|
||||||
from classes.holo_user import HoloUser
|
from classes.holo_user import HoloUser
|
||||||
|
from modules.logging import logWrite
|
||||||
from modules.utils import configGet, locale, should_quote
|
from modules.utils import configGet, locale, should_quote
|
||||||
from modules.handlers.welcome import welcome_pass
|
from modules.handlers.welcome import welcome_pass
|
||||||
from modules.database import col_tmp
|
from modules.database import col_tmp
|
||||||
@@ -35,7 +36,7 @@ async def cmd_reapply(app: Client, msg: Message):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
if holo_user.sponsorship_state()[1] is True:
|
if holo_user.application_state()[1] is True and holo_user.application_state()[0] != "fill":
|
||||||
|
|
||||||
await msg.reply_text(locale("reapply_left_chat", "message", locale=holo_user), reply_markup=InlineKeyboardMarkup([
|
await msg.reply_text(locale("reapply_left_chat", "message", locale=holo_user), reply_markup=InlineKeyboardMarkup([
|
||||||
[
|
[
|
||||||
@@ -47,6 +48,7 @@ async def cmd_reapply(app: Client, msg: Message):
|
|||||||
]))
|
]))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
holo_user.application_restart(reapply=True)
|
holo_user.application_restart(reapply=True)
|
||||||
await welcome_pass(app, msg, once_again=True)
|
await welcome_pass(app, msg, once_again=True)
|
||||||
|
|
||||||
|
@@ -15,7 +15,11 @@ async def member_func(_, __, msg: Message):
|
|||||||
return True if (msg.from_user.id in jsonLoad(path.join(configGet("cache", "locations"), "group_members"))) else False
|
return True if (msg.from_user.id in jsonLoad(path.join(configGet("cache", "locations"), "group_members"))) else False
|
||||||
|
|
||||||
async def allowed_func(_, __, msg: Message):
|
async def allowed_func(_, __, msg: Message):
|
||||||
return True if (col_applications.find_one({"user": msg.from_user.id}) is not None) else False
|
output = False
|
||||||
|
output = True if (col_applications.find_one({"user": msg.from_user.id}) is not None) else False
|
||||||
|
if path.exists(path.join(configGet("cache", "locations"), "group_members")) and (msg.from_user.id not in jsonLoad(path.join(configGet("cache", "locations"), "group_members"))):
|
||||||
|
output = False
|
||||||
|
return output
|
||||||
|
|
||||||
async def enabled_general_func(_, __, msg: Message):
|
async def enabled_general_func(_, __, msg: Message):
|
||||||
return configGet("enabled", "features", "general")
|
return configGet("enabled", "features", "general")
|
||||||
|
@@ -6,7 +6,7 @@ from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from ujson import dumps
|
from ujson import dumps
|
||||||
from app import app
|
from app import app
|
||||||
from pyrogram.types import BotCommand, BotCommandScopeChat
|
from pyrogram.types import BotCommand, BotCommandScopeChat, BotCommandScopeChatAdministrators
|
||||||
from pyrogram.errors import bad_request_400
|
from pyrogram.errors import bad_request_400
|
||||||
from pyrogram.enums.chat_members_filter import ChatMembersFilter
|
from pyrogram.enums.chat_members_filter import ChatMembersFilter
|
||||||
from classes.holo_user import HoloUser
|
from classes.holo_user import HoloUser
|
||||||
@@ -110,6 +110,7 @@ async def commands_register():
|
|||||||
"owner": [],
|
"owner": [],
|
||||||
"group_users": [],
|
"group_users": [],
|
||||||
"group_admins": [],
|
"group_admins": [],
|
||||||
|
"group_users_admins": [],
|
||||||
"locales": {}
|
"locales": {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +120,7 @@ async def commands_register():
|
|||||||
"owner": [],
|
"owner": [],
|
||||||
"group_users": [],
|
"group_users": [],
|
||||||
"group_admins": [],
|
"group_admins": [],
|
||||||
|
"group_users_admins": [],
|
||||||
"locales": {}
|
"locales": {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +135,8 @@ async def commands_register():
|
|||||||
"admins": [],
|
"admins": [],
|
||||||
"owner": [],
|
"owner": [],
|
||||||
"group_users": [],
|
"group_users": [],
|
||||||
"group_admins": []
|
"group_admins": [],
|
||||||
|
"group_users_admins": []
|
||||||
}
|
}
|
||||||
if configGet("debug") is True:
|
if configGet("debug") is True:
|
||||||
commands_raw["locales"][".".join(entry.split(".")[:-1])] = {
|
commands_raw["locales"][".".join(entry.split(".")[:-1])] = {
|
||||||
@@ -141,7 +144,8 @@ async def commands_register():
|
|||||||
"admins": [],
|
"admins": [],
|
||||||
"owner": [],
|
"owner": [],
|
||||||
"group_users": [],
|
"group_users": [],
|
||||||
"group_admins": []
|
"group_admins": [],
|
||||||
|
"group_users_admins": []
|
||||||
}
|
}
|
||||||
|
|
||||||
config_modules = configGet("features")
|
config_modules = configGet("features")
|
||||||
@@ -217,6 +221,13 @@ async def commands_register():
|
|||||||
except bad_request_400.ChannelInvalid:
|
except bad_request_400.ChannelInvalid:
|
||||||
logWrite(f"Could not register commands for destination group. Bot is likely not in the group.")
|
logWrite(f"Could not register commands for destination group. Bot is likely not in the group.")
|
||||||
|
|
||||||
|
# Registering destination group admin commands
|
||||||
|
try:
|
||||||
|
await app.set_bot_commands(commands["group_users_admins"], scope=BotCommandScopeChatAdministrators(chat_id=configGet("users", "groups")))
|
||||||
|
logWrite("Registered destination group admin commands")
|
||||||
|
except bad_request_400.ChannelInvalid:
|
||||||
|
logWrite(f"Could not register admin commands for destination group. Bot is likely not in the group.")
|
||||||
|
|
||||||
|
|
||||||
if configGet("debug") is True:
|
if configGet("debug") is True:
|
||||||
print(commands, flush=True)
|
print(commands, flush=True)
|
||||||
|
Reference in New Issue
Block a user