Переглянути джерело

Fixed METHOD_NOT_INVALID and some more things

TheHamkerCat 5 роки тому
батько
коміт
6964ffe750

+ 0 - 38
.github/workflows/main.yml

@@ -1,38 +0,0 @@
-name: PyLint
-
-on:
-  push:
-    branches: [ master ]
-  workflow_dispatch:
-
-jobs:
-  PEP8:
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v2
-
-      - name: Setup Python
-        uses: actions/setup-python@v1
-        with:
-          python-version: 3.9
-      - name: Install Python lint libraries
-        run: |
-          pip3 install autoflake isort black
-      - name: Remove unused imports and variables
-        run: |
-          autoflake --in-place --recursive --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports .
-      - name: lint with isort
-        run: |
-          isort .
-      - name: lint with black
-        run: |
-          black .
-      # commit changes
-      - uses: stefanzweifel/git-auto-commit-action@v4
-        with:
-          commit_message: '[AUTO] Code-Format'
-          commit_options: '--no-verify'
-          repository: .
-          commit_user_name: TheHamkerCat
-          commit_user_email: thehamkercat@gmail.com
-          commit_author: TheHamkerCat <thehamkercat@gmail.com>

+ 1 - 1
sample_config.env

@@ -24,7 +24,7 @@ WELCOME_DELAY_KICK_SEC=300 # Edit if u want
 
 MONGO_DB_URI=your_mongodb_uri
 
-ARQ_API_URL=http://thearq.tech # Leave it
+ARQ_API_URL=https://thearq.tech # Leave it like this
 
 ARQ_API_KEY=your_api_key # Get it from @ARQRobot
 

+ 1 - 1
sample_config.py

@@ -53,7 +53,7 @@ else:
     WELCOME_DELAY_KICK_SEC = 300
     MONGO_DB_URI = "mongodb+srv://username:password@cluster0.ksiis.mongodb.net/YourDataBaseName?retryWrites=true&w=majority"
     ARQ_API_KEY = "Get this from @ARQRobot"
-    ARQ_API_URL = "http://thearq.tech"
+    ARQ_API_URL = "https://thearq.tech"
     LOG_MENTIONS = True
     SPAM_CHECK_EXCEPTION_GROUPS = (
         []

+ 4 - 1
wbb/modules/admin.py

@@ -561,7 +561,10 @@ async def check_warns(_, message: Message):
 
 
 @app.on_message(
-    (filters.command("report") | filters.command("admins", prefixes="@"))
+    (
+        filters.command("report")
+        | filters.command("admins", prefixes="@")
+    )
     & ~filters.edited
     & ~filters.private
 )

+ 2 - 2
wbb/modules/misc.py

@@ -58,8 +58,8 @@ __HELP__ = """
 @app.on_message(filters.command("commit") & ~filters.edited)
 async def commit(_, message):
     await message.reply_text(
-            await get("http://whatthecommit.com/index.txt")
-            )
+        await get("http://whatthecommit.com/index.txt")
+    )
 
 
 @app.on_message(filters.command("RTFM", "#"))

+ 1 - 1
wbb/utils/functions.py

@@ -252,7 +252,7 @@ async def test_ARQ(message):
         "nsfw_scan": arq.nsfw_scan(
             url="https://www.pixsy.com/wp-content/uploads/2021/04/ben-sweet-2LowviVHZ-E-unsplash-1.jpeg"
         ),
-        "pornhub": arq.pornhub("incest"),
+        "pornhub": arq.pornhub("something"),
         "proxy": arq.proxy(),
         "pypi": arq.pypi("python-arq"),
         "reddit": arq.reddit("porn"),

+ 4 - 0
wbb/utils/http.py

@@ -34,6 +34,7 @@ async def get(url: str, *args, **kwargs):
             data = await resp.text()
     return data
 
+
 async def head(url: str, *args, **kwargs):
     async with session.head(url, *args, **kwargs) as resp:
         try:
@@ -42,6 +43,7 @@ async def head(url: str, *args, **kwargs):
             data = await resp.text()
     return data
 
+
 async def post(url: str, *args, **kwargs):
     async with session.post(url, *args, **kwargs) as resp:
         try:
@@ -56,11 +58,13 @@ async def multiget(url: str, times: int, *args, **kwargs):
         *[get(url, *args, **kwargs) for _ in range(times)]
     )
 
+
 async def multihead(url: str, times: int, *args, **kwargs):
     return await gather(
         *[head(url, *args, **kwargs) for _ in range(times)]
     )
 
+
 async def multipost(url: str, times: int, *args, **kwargs):
     return await gather(
         *[post(url, *args, **kwargs) for _ in range(times)]

+ 13 - 9
wbb/utils/inlinefuncs.py

@@ -26,6 +26,7 @@ import json
 import os
 import sys
 from random import randint
+from re import sub as re_sub
 from sys import version as pyver
 from time import ctime, time
 
@@ -46,8 +47,8 @@ from wbb import (BOT_USERNAME, MESSAGE_DUMP_CHAT, SUDOERS, USERBOT_ID,
 from wbb.core.types import InlineQueryResultCachedDocument
 from wbb.modules.info import get_chat_info, get_user_info
 from wbb.modules.music import download_youtube_audio
-from wbb.utils.http import get
 from wbb.utils.functions import test_speedtest
+from wbb.utils.http import get
 from wbb.utils.pastebin import paste
 
 keywords_list = [
@@ -201,17 +202,18 @@ async def urban_func(answers, text):
         return answers
     results = results.result[0:48]
     for i in results:
+        clean = lambda x: re_sub(r"[\[\]]", "", x)
         msg = f"""
 **Query:** {text}
 
-**Definition:** __{i.definition}__
+**Definition:** __{clean(i.definition)}__
 
-**Example:** __{i.example}__"""
+**Example:** __{clean(i.example)}__"""
 
         answers.append(
             InlineQueryResultArticle(
                 title=i.word,
-                description=i.definition,
+                description=clean(i.definition),
                 input_message_content=InputTextMessageContent(msg),
             )
         )
@@ -594,11 +596,13 @@ async def music_inline_func(answers, query):
     messages_ids = [ff_["message_id"] for ff_ in messages]
     messages = await app.get_messages(chat_id, messages_ids[0:48])
     return [
-            InlineQueryResultCachedDocument(
-                file_id=message_.audio.file_id,
-                title=message_.audio.title,
-            ) for message_ in messages
-            ]
+        InlineQueryResultCachedDocument(
+            file_id=message_.audio.file_id,
+            title=message_.audio.title,
+        )
+        for message_ in messages
+    ]
+
 
 async def wiki_func(answers, text):
     data = await arq.wiki(text)