From 2cc9accb7c4e2d458331292fbf2678665e167708 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Wed, 13 Dec 2023 11:34:49 +0000 Subject: [PATCH 1/2] refactor: remove unused imports An object has been imported but is not used anywhere in the file. It should either be used or the import should be removed. --- cogs/skyfun.py | 1 - skySB.py | 2 -- utils.py | 4 ---- 3 files changed, 7 deletions(-) diff --git a/cogs/skyfun.py b/cogs/skyfun.py index 6b9e5a8..ea63c0a 100644 --- a/cogs/skyfun.py +++ b/cogs/skyfun.py @@ -7,7 +7,6 @@ # AGPL-3.0 license import random -import string import discord from discord.ext import commands as skySB diff --git a/skySB.py b/skySB.py index f405834..9da6910 100644 --- a/skySB.py +++ b/skySB.py @@ -7,8 +7,6 @@ # AGPL-3.0 license import os - -import discord from utils import config, motd, bot, logger from colored import Fore, Style diff --git a/utils.py b/utils.py index 5b778d1..c68bb5c 100644 --- a/utils.py +++ b/utils.py @@ -10,13 +10,9 @@ import logging import asyncio import os -import io - -import discord from discord.ext import commands from colored import Fore, Style -from types import FunctionType # Logging logging.basicConfig(format=f"%(asctime)s | [{Fore.CYAN}%(levelname)s{Style.RESET}] %(message)s", level=logging.WARNING, datefmt='%H:%M') From 40c5286977d94ab51a5f505ebda6b5ce2de875f9 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Wed, 13 Dec 2023 11:35:01 +0000 Subject: [PATCH 2/2] style: format code with Autopep8 This commit fixes the style issues introduced in 2cc9acc according to the output from Autopep8. Details: https://github.com/sky-SB/selfbot/pull/5 --- cogs/skyfun.py | 30 ++++++++++++++++-------------- skySB.py | 13 +++++++------ utils.py | 49 ++++++++++++++++++++++++++++--------------------- 3 files changed, 51 insertions(+), 41 deletions(-) diff --git a/cogs/skyfun.py b/cogs/skyfun.py index ea63c0a..8261676 100644 --- a/cogs/skyfun.py +++ b/cogs/skyfun.py @@ -1,9 +1,9 @@ -# ______ __ __ __ __ ______ ______ -# /\ ___\ /\ \/ / /\ \_\ \ /\ ___\ /\ == \ -# \ \___ \ \ \ _--. \ \____ \ \ \___ \ \ \ __< +# ______ __ __ __ __ ______ ______ +# /\ ___\ /\ \/ / /\ \_\ \ /\ ___\ /\ == \ +# \ \___ \ \ \ _--. \ \____ \ \ \___ \ \ \ __< # \/\_____\ \ \_\ \_\ \/\_____\ \/\_____\ \ \_____\ # \/_____/ \/_/\/_/ \/_____/ \/_____/ \/_____/ -# +# # AGPL-3.0 license import random @@ -12,11 +12,12 @@ from discord.ext import commands as skySB import utils + class Fun(skySB.Cog): def __init__(self, bot): self.bot = bot self.langpack = utils.Langs.getcurrent()['fun'] - + @skySB.command( description=utils.Langs.getcurrent()['fun']['dick']['description'] ) @@ -25,10 +26,10 @@ async def dick(self, ctx, user: discord.User = None): mention = user.mention else: mention = self.bot.user - + size = random.randint(1, 1000) await utils.answer( - ctx, + ctx, self.langpack['dick']['text'].format(mention, size)) @skySB.command( @@ -39,12 +40,12 @@ async def iq(self, ctx, user: discord.User = None): mention = user.mention else: mention = self.bot.user - + iq = random.randint(1, 1000) await utils.answer( - ctx, + ctx, self.langpack['iq']['text'].format(mention, iq)) - + @skySB.command( description=utils.Langs.getcurrent()['fun']['gay']['description'] ) @@ -53,11 +54,12 @@ async def gay(self, ctx, user: discord.User = None): mention = user.mention else: mention = self.bot.user - + percent = random.randint(0, 101) await utils.answer( - ctx, + ctx, self.langpack['gay']['text'].format(mention, percent)) - + + async def setup(bot): - await bot.add_cog(Fun(bot)) \ No newline at end of file + await bot.add_cog(Fun(bot)) diff --git a/skySB.py b/skySB.py index 9da6910..19698d7 100644 --- a/skySB.py +++ b/skySB.py @@ -1,9 +1,9 @@ -# ______ __ __ __ __ ______ ______ -# /\ ___\ /\ \/ / /\ \_\ \ /\ ___\ /\ == \ -# \ \___ \ \ \ _--. \ \____ \ \ \___ \ \ \ __< +# ______ __ __ __ __ ______ ______ +# /\ ___\ /\ \/ / /\ \_\ \ /\ ___\ /\ == \ +# \ \___ \ \ \ _--. \ \____ \ \ \___ \ \ \ __< # \/\_____\ \ \_\ \_\ \/\_____\ \/\_____\ \ \_____\ # \/_____/ \/_/\/_/ \/_____/ \/_____/ \/_____/ -# +# # AGPL-3.0 license import os @@ -13,6 +13,7 @@ print(motd) logger.warning(f'status: {Fore.YELLOW}loading...{Style.RESET}') + @bot.event async def on_ready(): os.system('clear') @@ -21,7 +22,7 @@ async def on_ready(): logger.warning(f'connected: {Style.BOLD}{bot.user}{Style.RESET}') logger.warning(f'prefix: {Style.BOLD}{config.get("prefix")}{Style.RESET}') print("-" * 45) - + for file in os.listdir(f"{os.path.realpath(os.path.dirname(__file__))}/cogs"): if file.startswith("_"): pass @@ -34,4 +35,4 @@ async def on_ready(): logger.error(f'{extension}: {exception}') while True: - bot.run(config.get('token'), log_handler=None) \ No newline at end of file + bot.run(config.get('token'), log_handler=None) diff --git a/utils.py b/utils.py index c68bb5c..1d2c504 100644 --- a/utils.py +++ b/utils.py @@ -1,9 +1,9 @@ -# ______ __ __ __ __ ______ ______ -# /\ ___\ /\ \/ / /\ \_\ \ /\ ___\ /\ == \ -# \ \___ \ \ \ _--. \ \____ \ \ \___ \ \ \ __< +# ______ __ __ __ __ ______ ______ +# /\ ___\ /\ \/ / /\ \_\ \ /\ ___\ /\ == \ +# \ \___ \ \ \ _--. \ \____ \ \ \___ \ \ \ __< # \/\_____\ \ \_\ \_\ \/\_____\ \/\_____\ \ \_____\ # \/_____/ \/_/\/_/ \/_____/ \/_____/ \/_____/ -# +# # AGPL-3.0 license import json @@ -15,7 +15,8 @@ from colored import Fore, Style # Logging -logging.basicConfig(format=f"%(asctime)s | [{Fore.CYAN}%(levelname)s{Style.RESET}] %(message)s", level=logging.WARNING, datefmt='%H:%M') +logging.basicConfig( + format=f"%(asctime)s | [{Fore.CYAN}%(levelname)s{Style.RESET}] %(message)s", level=logging.WARNING, datefmt='%H:%M') logger = logging.getLogger(__name__) @@ -30,34 +31,35 @@ ) bot.remove_command('help') + class Langs: @staticmethod def all() -> list: """ Get all langpacks - + Returns: List - list all langpacks in directory. """ return os.listdir('./langs/') - + @staticmethod def getcurrent() -> dict: """ Get current langpack - + Returns: Dict - langpack JSON data """ with open(config.get('language')) as f: langpack = json.load(f) return langpack - + @staticmethod def get(file: str) -> dict: """ Get langpack - + Parameters: file (String) - file path Returns: @@ -65,9 +67,10 @@ def get(file: str) -> dict: """ with open(file) as f: langpack = json.load(f) - + return langpack + # MOTD motd = """ ______ __ __ __ __ ______ ______ @@ -77,8 +80,9 @@ def get(file: str) -> dict: \/_____/ \/_/\/_/ \/_____/ \/_____/ \/_____/ """ + async def answer( - ctx, + ctx, message: str, photo: bool = False, document: bool = False, @@ -86,11 +90,11 @@ async def answer( ) -> str: """ Answer text - + Parameters: ctx (Content), message (String) - + Returns: String - message text """ @@ -104,19 +108,20 @@ async def answer( responses.append(await ctx.message.edit(message)) except: responses.append(await ctx.reply(message)) - + await asyncio.sleep(config.get('deletetimer')) - + for response in responses: await response.delete() return responses + def get_ram() -> float: """ ! from teagram - + Get your ram usage - + Returns: Float - ram usage """ @@ -130,10 +135,11 @@ def get_ram() -> float: except: return 0 + def get_cpu() -> float: """ ! from teagram - + Get CPU usage as a percentage Returns: @@ -153,10 +159,11 @@ def get_cpu() -> float: except: return 0 + def get_platform() -> str: """ ! from teagram - + Get the platform information Returns: @@ -186,4 +193,4 @@ def get_platform() -> str: elif IS_ZACHOST: return "❔ Zachem㉿Host" else: - return "🖥️ VDS" \ No newline at end of file + return "🖥️ VDS"