User bans, emoji and other bug fixes, age limiter, etc #26

Merged
profitroll merged 31 commits from dev into master 2023-01-31 15:26:56 +02:00
2 changed files with 11 additions and 2 deletions
Showing only changes of commit 82a878aa6d - Show all commits

View File

@ -4,10 +4,11 @@ usage in context of Holo Users."""
from os import path from os import path
from app import isAnAdmin from app import isAnAdmin
from modules.utils import configGet, jsonLoad from modules.utils import configGet, jsonLoad
from modules.database import col_applications, col_tmp from modules.database import col_applications, col_tmp, col_bans
from pyrogram import filters from pyrogram import filters
from pyrogram.types import Message from pyrogram.types import Message
async def admin_func(_, __, msg: Message): async def admin_func(_, __, msg: Message):
return await isAnAdmin(msg.from_user.id) return await isAnAdmin(msg.from_user.id)
@ -21,6 +22,11 @@ async def allowed_func(_, __, msg: Message):
output = False output = False
return output return output
async def banned_func(_, __, msg: Message):
return True if col_bans.find_one( {"user": msg.from_user.id} ) is not None else False
async def enabled_general_func(_, __, msg: Message): async def enabled_general_func(_, __, msg: Message):
return configGet("enabled", "features", "general") return configGet("enabled", "features", "general")
@ -49,6 +55,8 @@ admin = filters.create(admin_func)
member = filters.create(member_func) member = filters.create(member_func)
allowed = filters.create(allowed_func) allowed = filters.create(allowed_func)
banned = filters.create(banned_func)
enabled_general = filters.create(enabled_general_func) enabled_general = filters.create(enabled_general_func)
enabled_applications = filters.create(enabled_applications_func) enabled_applications = filters.create(enabled_applications_func)
enabled_sponsorships = filters.create(enabled_sponsorships_func) enabled_sponsorships = filters.create(enabled_sponsorships_func)

View File

@ -28,11 +28,12 @@ db = db_client.get_database(name=db_config["name"])
collections = db.list_collection_names() collections = db.list_collection_names()
for collection in ["tmp", "users", "context", "youtube", "spoilers", "messages", "warnings", "applications", "sponsorships"]: for collection in ["tmp", "bans", "users", "context", "youtube", "spoilers", "messages", "warnings", "applications", "sponsorships"]:
if not collection in collections: if not collection in collections:
db.create_collection(collection) db.create_collection(collection)
col_tmp = db.get_collection("tmp") col_tmp = db.get_collection("tmp")
col_bans = db.get_collection("bans")
col_users = db.get_collection("users") col_users = db.get_collection("users")
col_context = db.get_collection("context") col_context = db.get_collection("context")
col_youtube = db.get_collection("youtube") col_youtube = db.get_collection("youtube")