Spaces:
Paused
Paused
Alexainc commited on
Commit ·
2e85f25
1
Parent(s): e20d07c
fix: help formatting text and tagall cancel logic
Browse files- QueenNoxi/__main__.py +19 -8
- QueenNoxi/modules/formatting.py +21 -22
- QueenNoxi/modules/tagall.py +8 -9
QueenNoxi/__main__.py
CHANGED
|
@@ -189,12 +189,22 @@ async def help_button(client, query: CallbackQuery):
|
|
| 189 |
)
|
| 190 |
+ HELPABLE[module].__help__
|
| 191 |
)
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
elif prev_match:
|
| 199 |
curr_page = int(prev_match.group(1))
|
| 200 |
await query.message.edit_caption(HELP_STRINGS,
|
|
@@ -216,8 +226,9 @@ async def help_button(client, query: CallbackQuery):
|
|
| 216 |
),
|
| 217 |
)
|
| 218 |
await query.answer()
|
| 219 |
-
except Exception:
|
| 220 |
-
|
|
|
|
| 221 |
|
| 222 |
@pbot.on_callback_query(filters.regex(r"^queennoxi_"))
|
| 223 |
async def QueenNoxi_about_callback(client, query: CallbackQuery):
|
|
|
|
| 189 |
)
|
| 190 |
+ HELPABLE[module].__help__
|
| 191 |
)
|
| 192 |
+
try:
|
| 193 |
+
await query.message.edit_caption(text,
|
| 194 |
+
reply_markup=InlineKeyboardMarkup(
|
| 195 |
+
[[InlineKeyboardButton(text="ʙᴀᴄᴋ", callback_data="help_back"),
|
| 196 |
+
InlineKeyboardButton(text="sᴜᴘᴘᴏʀᴛ", callback_data="queennoxi_support")]]
|
| 197 |
+
),
|
| 198 |
+
)
|
| 199 |
+
except RPCError as e:
|
| 200 |
+
# Fallback if caption is still too long or other RPC error
|
| 201 |
+
LOGGER.error(f"Error editing help caption: {e}")
|
| 202 |
+
await query.message.reply_text(text,
|
| 203 |
+
reply_markup=InlineKeyboardMarkup(
|
| 204 |
+
[[InlineKeyboardButton(text="ʙᴀᴄᴋ", callback_data="help_back"),
|
| 205 |
+
InlineKeyboardButton(text="sᴜᴘᴘᴏʀᴛ", callback_data="queennoxi_support")]]
|
| 206 |
+
),
|
| 207 |
+
)
|
| 208 |
elif prev_match:
|
| 209 |
curr_page = int(prev_match.group(1))
|
| 210 |
await query.message.edit_caption(HELP_STRINGS,
|
|
|
|
| 226 |
),
|
| 227 |
)
|
| 228 |
await query.answer()
|
| 229 |
+
except Exception as e:
|
| 230 |
+
LOGGER.error(f"Error in help_button: {e}")
|
| 231 |
+
await query.answer("An error occurred while opening help.", show_alert=True)
|
| 232 |
|
| 233 |
@pbot.on_callback_query(filters.regex(r"^queennoxi_"))
|
| 234 |
async def QueenNoxi_about_callback(client, query: CallbackQuery):
|
QueenNoxi/modules/formatting.py
CHANGED
|
@@ -4,34 +4,33 @@ from QueenNoxi import pbot
|
|
| 4 |
__mod_name__ = "Formatting"
|
| 5 |
|
| 6 |
__help__ = """
|
| 7 |
-
|
| 8 |
|
| 9 |
**User Info:**
|
| 10 |
-
• `{first}`:
|
| 11 |
-
• `{last}`:
|
| 12 |
-
• `{fullname}`:
|
| 13 |
-
• `{username}`:
|
| 14 |
-
• `{id}`:
|
| 15 |
-
• `{mention}`:
|
| 16 |
|
| 17 |
**Chat Info:**
|
| 18 |
-
• `{chatname}`:
|
| 19 |
-
• `{rules}`:
|
| 20 |
|
| 21 |
-
**
|
| 22 |
-
• `{preview}`:
|
| 23 |
-
• `{nonotif}`:
|
| 24 |
-
• `{protect}`:
|
| 25 |
-
• `{mediaspoiler}`:
|
| 26 |
|
| 27 |
**Buttons:**
|
| 28 |
-
• `[
|
| 29 |
-
• `[
|
| 30 |
-
• `[
|
| 31 |
-
• `[
|
| 32 |
-
• `[
|
| 33 |
-
• `[
|
| 34 |
|
| 35 |
-
**Note
|
| 36 |
-
Link previews are **DISABLED** by default. To enable them, include `{preview}` anywhere in your message.
|
| 37 |
"""
|
|
|
|
| 4 |
__mod_name__ = "Formatting"
|
| 5 |
|
| 6 |
__help__ = """
|
| 7 |
+
Personalize your welcome, filters, or notes with these placeholders:
|
| 8 |
|
| 9 |
**User Info:**
|
| 10 |
+
• `{first}`: First name.
|
| 11 |
+
• `{last}`: Last name.
|
| 12 |
+
• `{fullname}`: Full name.
|
| 13 |
+
• `{username}`: @username.
|
| 14 |
+
• `{id}`: User ID.
|
| 15 |
+
• `{mention}`: Mention user.
|
| 16 |
|
| 17 |
**Chat Info:**
|
| 18 |
+
• `{chatname}`: Group name.
|
| 19 |
+
• `{rules}`: Link to rules.
|
| 20 |
|
| 21 |
+
**Control Tags:**
|
| 22 |
+
• `{preview}`: Enable link previews.
|
| 23 |
+
• `{nonotif}`: Muted message.
|
| 24 |
+
• `{protect}`: Prevent forward/screenshot.
|
| 25 |
+
• `{mediaspoiler}`: Blur media.
|
| 26 |
|
| 27 |
**Buttons:**
|
| 28 |
+
• `[Text](buttonurl://link)`: URL button.
|
| 29 |
+
• `[Text](buttonurl#danger://link)`: Red button.
|
| 30 |
+
• `[Text](buttonurl#success://link)`: Green button.
|
| 31 |
+
• `[Text](buttonurl#primary://link)`: Blue button.
|
| 32 |
+
• `[Text](buttonurl://btn_next)`: Next page.
|
| 33 |
+
• `[Text](buttonurl://btn_back)`: Previous page.
|
| 34 |
|
| 35 |
+
**Note:** Previews are **DISABLED** by default. Use `{preview}` to enable.
|
|
|
|
| 36 |
"""
|
QueenNoxi/modules/tagall.py
CHANGED
|
@@ -7,7 +7,7 @@ from telethon.tl.types import ChannelParticipantAdmin, ChannelParticipantCreator
|
|
| 7 |
|
| 8 |
from QueenNoxi import telethn as client
|
| 9 |
|
| 10 |
-
spam_chats =
|
| 11 |
|
| 12 |
@client.on(events.NewMessage(pattern="^@tagall ?(.*)"))
|
| 13 |
@client.on(events.NewMessage(pattern="^@all ?(.*)"))
|
|
@@ -50,15 +50,17 @@ async def mentionall(event):
|
|
| 50 |
"__Reply to a message or give me some text to mention others!__"
|
| 51 |
)
|
| 52 |
|
| 53 |
-
spam_chats.
|
| 54 |
usrnum = 0
|
| 55 |
usrtxt = ""
|
| 56 |
async for usr in client.iter_participants(chat_id):
|
| 57 |
-
if
|
| 58 |
break
|
| 59 |
usrnum += 1
|
| 60 |
usrtxt += f"[{usr.first_name}](tg://user?id={usr.id}), "
|
| 61 |
if usrnum == 15:
|
|
|
|
|
|
|
| 62 |
if mode == "text_on_cmd":
|
| 63 |
txt = f"{msg}\n{usrtxt}"
|
| 64 |
await client.send_message(chat_id, txt)
|
|
@@ -68,14 +70,14 @@ async def mentionall(event):
|
|
| 68 |
usrnum = 0
|
| 69 |
usrtxt = ""
|
| 70 |
try:
|
| 71 |
-
spam_chats.
|
| 72 |
except:
|
| 73 |
pass
|
| 74 |
|
| 75 |
|
| 76 |
@client.on(events.NewMessage(pattern="^/cancel$"))
|
| 77 |
async def cancel_spam(event):
|
| 78 |
-
if
|
| 79 |
return await event.respond("ᴛʜᴇʀᴇ ɪs ɴᴏ ᴘʀᴏᴄᴄᴇss ᴏɴ ɢᴏɪɴɢ..")
|
| 80 |
is_admin = False
|
| 81 |
try:
|
|
@@ -91,10 +93,7 @@ async def cancel_spam(event):
|
|
| 91 |
return await event.respond("__ᴏɴʟʏ ᴀᴅᴍɪɴs ᴄᴀɴ ᴇxᴇᴄᴜᴛᴇ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ!__")
|
| 92 |
|
| 93 |
else:
|
| 94 |
-
|
| 95 |
-
spam_chats.remove(event.chat_id)
|
| 96 |
-
except:
|
| 97 |
-
pass
|
| 98 |
return await event.respond("sᴛᴏᴘᴘᴇᴅ ᴍᴇɴᴛɪᴏɴ.__")
|
| 99 |
|
| 100 |
|
|
|
|
| 7 |
|
| 8 |
from QueenNoxi import telethn as client
|
| 9 |
|
| 10 |
+
spam_chats = set()
|
| 11 |
|
| 12 |
@client.on(events.NewMessage(pattern="^@tagall ?(.*)"))
|
| 13 |
@client.on(events.NewMessage(pattern="^@all ?(.*)"))
|
|
|
|
| 50 |
"__Reply to a message or give me some text to mention others!__"
|
| 51 |
)
|
| 52 |
|
| 53 |
+
spam_chats.add(chat_id)
|
| 54 |
usrnum = 0
|
| 55 |
usrtxt = ""
|
| 56 |
async for usr in client.iter_participants(chat_id):
|
| 57 |
+
if chat_id not in spam_chats:
|
| 58 |
break
|
| 59 |
usrnum += 1
|
| 60 |
usrtxt += f"[{usr.first_name}](tg://user?id={usr.id}), "
|
| 61 |
if usrnum == 15:
|
| 62 |
+
if chat_id not in spam_chats:
|
| 63 |
+
break
|
| 64 |
if mode == "text_on_cmd":
|
| 65 |
txt = f"{msg}\n{usrtxt}"
|
| 66 |
await client.send_message(chat_id, txt)
|
|
|
|
| 70 |
usrnum = 0
|
| 71 |
usrtxt = ""
|
| 72 |
try:
|
| 73 |
+
spam_chats.discard(chat_id)
|
| 74 |
except:
|
| 75 |
pass
|
| 76 |
|
| 77 |
|
| 78 |
@client.on(events.NewMessage(pattern="^/cancel$"))
|
| 79 |
async def cancel_spam(event):
|
| 80 |
+
if event.chat_id not in spam_chats:
|
| 81 |
return await event.respond("ᴛʜᴇʀᴇ ɪs ɴᴏ ᴘʀᴏᴄᴄᴇss ᴏɴ ɢᴏɪɴɢ..")
|
| 82 |
is_admin = False
|
| 83 |
try:
|
|
|
|
| 93 |
return await event.respond("__ᴏɴʟʏ ᴀᴅᴍɪɴs ᴄᴀɴ ᴇxᴇᴄᴜᴛᴇ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ!__")
|
| 94 |
|
| 95 |
else:
|
| 96 |
+
spam_chats.discard(event.chat_id)
|
|
|
|
|
|
|
|
|
|
| 97 |
return await event.respond("sᴛᴏᴘᴘᴇᴅ ᴍᴇɴᴛɪᴏɴ.__")
|
| 98 |
|
| 99 |
|