Jelajahi Sumber

Added filter in /pin

A new filter ~pinned will be create on /pin, which will show the link of pinned message on ~pinned
TheHamkerCat 5 tahun lalu
induk
melakukan
ce058537af
4 mengubah file dengan 17 tambahan dan 5 penghapusan
  1. 1 1
      wbb/__main__.py
  2. 10 2
      wbb/modules/admin.py
  3. 1 0
      wbb/modules/anonymize.py
  4. 5 2
      wbb/modules/music.py

+ 1 - 1
wbb/__main__.py

@@ -151,7 +151,7 @@ async def help_command(_, message):
                     callback_data="stats_callback",
                 ),
                 InlineKeyboardButton(
-                    text="Support 👨", url="t.me/WBBSupport"
+                    text="Support 👨", url="http://t.me/WBBSupport"
                 ),
             ],
             [

+ 10 - 2
wbb/modules/admin.py

@@ -30,7 +30,7 @@ from wbb import BOT_ID, SUDOERS, app
 from wbb.core.decorators.errors import capture_err
 from wbb.core.keyboard import ikb
 from wbb.utils.dbfunctions import (add_warn, get_warn, int_to_alpha,
-                                   remove_warns)
+                                   remove_warns, save_filter)
 from wbb.utils.functions import (extract_user,
                                  extract_user_and_reason,
                                  time_converter)
@@ -385,7 +385,15 @@ async def pin(_, message: Message):
         return await message.reply_text(
             "Reply to a message to pin it."
         )
-    await message.reply_to_message.pin(disable_notification=True)
+    r = message.reply_to_message
+    await r.pin(disable_notification=True)
+    await message.reply(
+        f"**Pinned [this]({r.link}) message.**",
+        disable_web_page_preview=True,
+    )
+    msg = "Please check the pinned message: ~ " + f"[Check, {r.link}]"
+    filter = dict(type="text", data=msg)
+    await save_filter(message.chat.id, "~pinned", filter)
 
 
 # Mute members

+ 1 - 0
wbb/modules/anonymize.py

@@ -66,6 +66,7 @@ async def change_profile(_, message: Message):
     await m.edit(f"[Anonymized.](tg://user?id={USERBOT_ID})")
     image.close()
 
+
 @app2.on_message(
     filters.command("impersonate", prefixes=USERBOT_PREFIX)
     & filters.user(SUDOERS)

+ 5 - 2
wbb/modules/music.py

@@ -26,16 +26,18 @@ from __future__ import unicode_literals
 import os
 from asyncio import get_running_loop
 from functools import partial
+from io import BytesIO
 from random import randint
 from urllib.parse import urlparse
-from io import BytesIO
+
 import aiofiles
 import aiohttp
 import ffmpeg
 import youtube_dl
 from pyrogram import filters
 
-from wbb import app, arq, aiohttpsession as session
+from wbb import aiohttpsession as session
+from wbb import app, arq
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.pastebin import paste
 
@@ -190,6 +192,7 @@ async def jssong(_, message):
     is_downloading = False
     song.close()
 
+
 # Lyrics