Kaynağa Gözat

Removed voice call

TheHamkerCat 5 yıl önce
ebeveyn
işleme
38494d44c4
4 değiştirilmiş dosya ile 16 ekleme ve 78 silme
  1. 0 2
      requirements.txt
  2. 0 9
      wbb/__init__.py
  3. 16 16
      wbb/modules/filters.py
  4. 0 51
      wbb/modules/voice_chat.py

+ 0 - 2
requirements.txt

@@ -1,5 +1,3 @@
-ffmpeg-python
-pytgcalls
 requests
 python-arq
 TgCrypto

+ 0 - 9
wbb/__init__.py

@@ -5,7 +5,6 @@ from config import (
     MAIN_CHATS
 )
 from pyrogram import Client
-from pytgcalls import GroupCall
 from motor.motor_asyncio import AsyncIOMotorClient as MongoClient
 from Python_ARQ import ARQ
 import time
@@ -71,13 +70,5 @@ app = Client(
     api_hash=API_HASH
 )
 
-# Pytgcalls client
-vc = GroupCall(
-        app2,
-        input_filename="input.raw",
-        play_on_repeat=False,
-        enable_logs_to_console=False
-        )
-
 # ARQ client
 arq = ARQ(ARQ_API)

+ 16 - 16
wbb/modules/filters.py

@@ -80,22 +80,22 @@ async def del_filter(_, message):
                 ~filters.forwarded, group=chat_filters_group)
 async def filters_re(_, message):
     try:
-        if message.text[0] != "/":
-            text = message.text.lower().strip()
-            if text:
-                chat_id = message.chat.id
-                list_of_filters = await get_filters_names(chat_id)
-                for word in list_of_filters:
-                    pattern = r"( |^|[^\w])" + re.escape(word) + r"( |$|[^\w])"
-                    if re.search(pattern, text, flags=re.IGNORECASE):
-                        _filter = await get_filter(chat_id, word)
-                        data_type = _filter['type']
-                        data = _filter['data']
-                        if data_type == "text":
-                            await message.reply_text(data)
-                        else:
-                            await message.reply_sticker(data)
-                        return
+        text = message.text.lower().strip()
+        if not text:
+            return
+        chat_id = message.chat.id
+        list_of_filters = await get_filters_names(chat_id)
+        for word in list_of_filters:
+            pattern = r"( |^|[^\w])" + re.escape(word) + r"( |$|[^\w])"
+            if re.search(pattern, text, flags=re.IGNORECASE):
+                _filter = await get_filter(chat_id, word)
+                data_type = _filter['type']
+                data = _filter['data']
+                if data_type == "text":
+                    await message.reply_text(data)
+                else:
+                    await message.reply_sticker(data)
+                return
     # NOTE When the first letter of the message is an emoji it throws an error, that's why using this
     except Exception:
         pass

+ 0 - 51
wbb/modules/voice_chat.py

@@ -1,51 +0,0 @@
-from pyrogram import filters
-from wbb import vc, arq, app
-from wbb.utils.errors import capture_err
-from wbb.utils.botinfo import USERBOT_ID
-import ffmpeg
-import aiohttp
-import aiofiles
-
-__MODULE__ = "Voice Chat"
-__HELP__ = """/joinvc - To Join A Voice Chat
-/music [SONG_NAME] - To Play Music In VC"""
-
-
-@app.on_message(filters.command("joinvc") & filters.user(USERBOT_ID))
-@capture_err
-async def joinvc(_, message):
-    if vc.is_connected:
-        await message.reply_text("__**Bot Is Already In Voice Chat.**__")
-        return
-    await vc.start(message.chat.id)
-    await message.reply_text("__**Joined The Voice Chat.**__")
-
-
-@app.on_message(filters.command("music") & filters.user(USERBOT_ID))
-@capture_err
-async def play_music(_, message):
-    if len(message.command) < 2:
-        await message.reply_text("**Usage:**\n/music [SONG_NAME]")
-        return
-    m = await message.reply_text("__**Searching**__")
-    query = message.text.split(None, 1)[1]
-    song = (await arq.saavn(query))[0]
-    await m.edit("__**Downloading**__")
-    await download_and_transcode_song(song.media_url)
-    await m.edit(f"__**Playing {song.song}\n**__")
-
-
-async def download_and_transcode_song(url):
-    async with aiohttp.ClientSession() as session:
-        async with session.get(url) as resp:
-            if resp.status == 200:
-                f = await aiofiles.open('song.mp3', mode='wb')
-                await f.write(await resp.read())
-                await f.close()
-    transcode("song.mp3")
-
-
-def transcode(filename):
-    ffmpeg.input(filename).output("input.raw", format='s16le',
-                                  acodec='pcm_s16le', ac=2, ar='48k').overwrite_output().run()
-    os.remove(filename)