|
@@ -412,22 +412,19 @@ async def fed_chat(client, message):
|
|
|
chat = message.chat
|
|
chat = message.chat
|
|
|
user = message.from_user
|
|
user = message.from_user
|
|
|
if message.chat.type != ChatType.PRIVATE:
|
|
if message.chat.type != ChatType.PRIVATE:
|
|
|
- await message.reply_text(
|
|
|
|
|
|
|
+ return await message.reply_text(
|
|
|
"Fedchats can only be checked by privately messaging me."
|
|
"Fedchats can only be checked by privately messaging me."
|
|
|
)
|
|
)
|
|
|
- return
|
|
|
|
|
if len(message.command) < 2:
|
|
if len(message.command) < 2:
|
|
|
- await message.reply_text(
|
|
|
|
|
|
|
+ return await message.reply_text(
|
|
|
"Please write the Id of the federation!\n\nUsage:\n/fedchats fed_id"
|
|
"Please write the Id of the federation!\n\nUsage:\n/fedchats fed_id"
|
|
|
)
|
|
)
|
|
|
- return
|
|
|
|
|
args = message.text.split(" ", 1)
|
|
args = message.text.split(" ", 1)
|
|
|
if len(args) > 1:
|
|
if len(args) > 1:
|
|
|
fed_id = args[1].strip()
|
|
fed_id = args[1].strip()
|
|
|
info = await get_fed_info(fed_id)
|
|
info = await get_fed_info(fed_id)
|
|
|
if info is False:
|
|
if info is False:
|
|
|
- await message.reply_text("This federation does not exist.")
|
|
|
|
|
- return
|
|
|
|
|
|
|
+ return await message.reply_text("This federation does not exist.")
|
|
|
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)]
|
|
@@ -452,6 +449,64 @@ async def fed_chat(client, message):
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+@app.on_message(filters.command("fedinfo"))
|
|
|
|
|
+@capture_err
|
|
|
|
|
+async def fed_info(client, message):
|
|
|
|
|
+ if len(message.command) < 2:
|
|
|
|
|
+ return await message.reply_text("Please provide the Fed Id to get information!")
|
|
|
|
|
+
|
|
|
|
|
+ fed_id = message.text.split(" ", 1)[1].strip()
|
|
|
|
|
+ fed_info = await get_fed_info(fed_id)
|
|
|
|
|
+
|
|
|
|
|
+ if not fed_info:
|
|
|
|
|
+ return await message.reply_text("Federation not found.")
|
|
|
|
|
+
|
|
|
|
|
+ fed_name = fed_info.get("fed_name")
|
|
|
|
|
+ owner_mention = fed_info.get("owner_mention")
|
|
|
|
|
+ fadmin_count = len(fed_info.get("fadmins", []))
|
|
|
|
|
+ banned_users_count = len(fed_info.get("banned_users", []))
|
|
|
|
|
+ chat_ids_count = len(fed_info.get("chat_ids", []))
|
|
|
|
|
+
|
|
|
|
|
+ reply_text = (
|
|
|
|
|
+ f"**Federation Information:**\n\n"
|
|
|
|
|
+ f"**Fed Name:** {fed_name}\n"
|
|
|
|
|
+ f"**Owner:** {owner_mention}\n"
|
|
|
|
|
+ f"**Number of Fed Admins:** {fadmin_count}\n"
|
|
|
|
|
+ f"**Number of Banned Users:** {banned_users_count}\n"
|
|
|
|
|
+ f"**Number of Chats:** {chat_ids_count}"
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ await message.reply_text(reply_text)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+@app.on_message(filters.command("fedadmins"))
|
|
|
|
|
+@capture_err
|
|
|
|
|
+async def get_all_fadmins_mentions(client, message):
|
|
|
|
|
+ if len(message.command) < 2:
|
|
|
|
|
+ await message.reply_text("Please provide me the Fed Id to search!")
|
|
|
|
|
+ return
|
|
|
|
|
+
|
|
|
|
|
+ fed_id = message.text.split(" ", 1)[1].strip()
|
|
|
|
|
+ fed_info = await get_fed_info(fed_id)
|
|
|
|
|
+ if not fed_info:
|
|
|
|
|
+ return await message.reply_text("Federation not found.")
|
|
|
|
|
+
|
|
|
|
|
+ fadmin_ids = fed_info.get("fadmins", [])
|
|
|
|
|
+ if not fadmin_ids:
|
|
|
|
|
+ return await message.reply_text(f"**Owner: {fed_info['owner_mention']}\n\nNo fadmins found in the federation.")
|
|
|
|
|
+
|
|
|
|
|
+ user_mentions = []
|
|
|
|
|
+ for user_id in fadmin_ids:
|
|
|
|
|
+ try:
|
|
|
|
|
+ user = await app.get_users(int(user_id))
|
|
|
|
|
+ user_mentions.append(f"● {user.mention}[`{user.id}`]")
|
|
|
|
|
+ except Exception:
|
|
|
|
|
+ user_mentions.append(f"● `Admin🥷`[`{user_id}`]")
|
|
|
|
|
+ reply_text = f"**Owner: {fed_info['owner_mention']}\n\nList of fadmins:**\n" + "\n".join(user_mentions)
|
|
|
|
|
+
|
|
|
|
|
+ await message.reply_text(reply_text)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
@app.on_message(filters.command("fpromote"))
|
|
@app.on_message(filters.command("fpromote"))
|
|
|
@capture_err
|
|
@capture_err
|
|
|
async def fpromote(client, message):
|
|
async def fpromote(client, message):
|
|
@@ -850,11 +905,6 @@ async def fbroadcast_message(client, message):
|
|
|
await m.edit(f"**Broadcasted Message In {sent} Chats.**")
|
|
await m.edit(f"**Broadcasted Message In {sent} Chats.**")
|
|
|
|
|
|
|
|
|
|
|
|
|
-@app.on_message(filters.command(["fedinfo", "fedadmins"]))
|
|
|
|
|
-async def to_do(client, message):
|
|
|
|
|
- await message.reply_text("**Feel free to use your coding skills and open a pull request.**")
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
@app.on_callback_query(filters.regex("rmfed_(.*)"))
|
|
@app.on_callback_query(filters.regex("rmfed_(.*)"))
|
|
|
async def del_fed_button(client, cb):
|
|
async def del_fed_button(client, cb):
|
|
|
query = cb.data
|
|
query = cb.data
|