diff --git a/poetry.lock b/poetry.lock index 8b55f5b..b32a6a2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -152,6 +152,48 @@ docs = ["cogapp", "furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphi tests = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] tests-mypy = ["mypy (>=1.11.1)", "pytest-mypy-plugins"] +[[package]] +name = "audioop-lts" +version = "0.2.1" +description = "LTS Port of Python audioop" +optional = false +python-versions = ">=3.13" +files = [ + {file = "audioop_lts-0.2.1-cp313-abi3-macosx_10_13_universal2.whl", hash = "sha256:fd1345ae99e17e6910f47ce7d52673c6a1a70820d78b67de1b7abb3af29c426a"}, + {file = "audioop_lts-0.2.1-cp313-abi3-macosx_10_13_x86_64.whl", hash = "sha256:e175350da05d2087e12cea8e72a70a1a8b14a17e92ed2022952a4419689ede5e"}, + {file = "audioop_lts-0.2.1-cp313-abi3-macosx_11_0_arm64.whl", hash = "sha256:4a8dd6a81770f6ecf019c4b6d659e000dc26571b273953cef7cd1d5ce2ff3ae6"}, + {file = "audioop_lts-0.2.1-cp313-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d1cd3c0b6f2ca25c7d2b1c3adeecbe23e65689839ba73331ebc7d893fcda7ffe"}, + {file = "audioop_lts-0.2.1-cp313-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ff3f97b3372c97782e9c6d3d7fdbe83bce8f70de719605bd7ee1839cd1ab360a"}, + {file = "audioop_lts-0.2.1-cp313-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a351af79edefc2a1bd2234bfd8b339935f389209943043913a919df4b0f13300"}, + {file = "audioop_lts-0.2.1-cp313-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2aeb6f96f7f6da80354330470b9134d81b4cf544cdd1c549f2f45fe964d28059"}, + {file = "audioop_lts-0.2.1-cp313-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c589f06407e8340e81962575fcffbba1e92671879a221186c3d4662de9fe804e"}, + {file = "audioop_lts-0.2.1-cp313-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:fbae5d6925d7c26e712f0beda5ed69ebb40e14212c185d129b8dfbfcc335eb48"}, + {file = "audioop_lts-0.2.1-cp313-abi3-musllinux_1_2_i686.whl", hash = "sha256:d2d5434717f33117f29b5691fbdf142d36573d751716249a288fbb96ba26a281"}, + {file = "audioop_lts-0.2.1-cp313-abi3-musllinux_1_2_ppc64le.whl", hash = "sha256:f626a01c0a186b08f7ff61431c01c055961ee28769591efa8800beadd27a2959"}, + {file = "audioop_lts-0.2.1-cp313-abi3-musllinux_1_2_s390x.whl", hash = "sha256:05da64e73837f88ee5c6217d732d2584cf638003ac72df124740460531e95e47"}, + {file = "audioop_lts-0.2.1-cp313-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:56b7a0a4dba8e353436f31a932f3045d108a67b5943b30f85a5563f4d8488d77"}, + {file = "audioop_lts-0.2.1-cp313-abi3-win32.whl", hash = "sha256:6e899eb8874dc2413b11926b5fb3857ec0ab55222840e38016a6ba2ea9b7d5e3"}, + {file = "audioop_lts-0.2.1-cp313-abi3-win_amd64.whl", hash = "sha256:64562c5c771fb0a8b6262829b9b4f37a7b886c01b4d3ecdbae1d629717db08b4"}, + {file = "audioop_lts-0.2.1-cp313-abi3-win_arm64.whl", hash = "sha256:c45317debeb64002e980077642afbd977773a25fa3dfd7ed0c84dccfc1fafcb0"}, + {file = "audioop_lts-0.2.1-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:3827e3fce6fee4d69d96a3d00cd2ab07f3c0d844cb1e44e26f719b34a5b15455"}, + {file = "audioop_lts-0.2.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:161249db9343b3c9780ca92c0be0d1ccbfecdbccac6844f3d0d44b9c4a00a17f"}, + {file = "audioop_lts-0.2.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:5b7b4ff9de7a44e0ad2618afdc2ac920b91f4a6d3509520ee65339d4acde5abf"}, + {file = "audioop_lts-0.2.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:72e37f416adb43b0ced93419de0122b42753ee74e87070777b53c5d2241e7fab"}, + {file = "audioop_lts-0.2.1-cp313-cp313t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:534ce808e6bab6adb65548723c8cbe189a3379245db89b9d555c4210b4aaa9b6"}, + {file = "audioop_lts-0.2.1-cp313-cp313t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d2de9b6fb8b1cf9f03990b299a9112bfdf8b86b6987003ca9e8a6c4f56d39543"}, + {file = "audioop_lts-0.2.1-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f24865991b5ed4b038add5edbf424639d1358144f4e2a3e7a84bc6ba23e35074"}, + {file = "audioop_lts-0.2.1-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2bdb3b7912ccd57ea53197943f1bbc67262dcf29802c4a6df79ec1c715d45a78"}, + {file = "audioop_lts-0.2.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:120678b208cca1158f0a12d667af592e067f7a50df9adc4dc8f6ad8d065a93fb"}, + {file = "audioop_lts-0.2.1-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:54cd4520fc830b23c7d223693ed3e1b4d464997dd3abc7c15dce9a1f9bd76ab2"}, + {file = "audioop_lts-0.2.1-cp313-cp313t-musllinux_1_2_ppc64le.whl", hash = "sha256:d6bd20c7a10abcb0fb3d8aaa7508c0bf3d40dfad7515c572014da4b979d3310a"}, + {file = "audioop_lts-0.2.1-cp313-cp313t-musllinux_1_2_s390x.whl", hash = "sha256:f0ed1ad9bd862539ea875fb339ecb18fcc4148f8d9908f4502df28f94d23491a"}, + {file = "audioop_lts-0.2.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:e1af3ff32b8c38a7d900382646e91f2fc515fd19dea37e9392275a5cbfdbff63"}, + {file = "audioop_lts-0.2.1-cp313-cp313t-win32.whl", hash = "sha256:f51bb55122a89f7a0817d7ac2319744b4640b5b446c4c3efcea5764ea99ae509"}, + {file = "audioop_lts-0.2.1-cp313-cp313t-win_amd64.whl", hash = "sha256:f0f2f336aa2aee2bce0b0dcc32bbba9178995454c7b979cf6ce086a8801e14c7"}, + {file = "audioop_lts-0.2.1-cp313-cp313t-win_arm64.whl", hash = "sha256:78bfb3703388c780edf900be66e07de5a3d4105ca8e8720c5c4d67927e0b15d0"}, + {file = "audioop_lts-0.2.1.tar.gz", hash = "sha256:e81268da0baa880431b68b1308ab7257eb33f356e57a5f9b1f915dfb13dd1387"}, +] + [[package]] name = "cffi" version = "1.17.1" @@ -282,21 +324,23 @@ test-randomorder = ["pytest-randomly"] [[package]] name = "discord-py" -version = "2.4.0" +version = "2.5.0" description = "A Python wrapper for the Discord API" optional = false python-versions = ">=3.8" files = [ - {file = "discord.py-2.4.0-py3-none-any.whl", hash = "sha256:b8af6711c70f7e62160bfbecb55be699b5cb69d007426759ab8ab06b1bd77d1d"}, - {file = "discord_py-2.4.0.tar.gz", hash = "sha256:d07cb2a223a185873a1d0ee78b9faa9597e45b3f6186df21a95cec1e9bcdc9a5"}, + {file = "discord.py-2.5.0-py3-none-any.whl", hash = "sha256:8e1e3b3ff5a112a4ab3a615059a285238eea34edff6de8737db6e1f72ea05195"}, + {file = "discord_py-2.5.0.tar.gz", hash = "sha256:f6827909b87ea89bdb2cc49d475cb1fada2e73235a3e4568fc8b113660340c73"}, ] [package.dependencies] aiohttp = ">=3.7.4,<4" +audioop-lts = {version = "*", markers = "python_version >= \"3.13\""} [package.extras] -docs = ["sphinx (==4.4.0)", "sphinx-inline-tabs (==2023.4.21)", "sphinxcontrib-applehelp (==1.0.4)", "sphinxcontrib-devhelp (==1.0.2)", "sphinxcontrib-htmlhelp (==2.0.1)", "sphinxcontrib-jsmath (==1.0.1)", "sphinxcontrib-qthelp (==1.0.3)", "sphinxcontrib-serializinghtml (==1.1.5)", "sphinxcontrib-trio (==1.1.2)", "sphinxcontrib-websupport (==1.2.4)", "typing-extensions (>=4.3,<5)"] -speed = ["Brotli", "aiodns (>=1.1)", "cchardet (==2.1.7)", "orjson (>=3.5.4)"] +dev = ["black (==22.6)", "typing_extensions (>=4.3,<5)"] +docs = ["imghdr-lts (==1.0.0)", "sphinx (==4.4.0)", "sphinx-inline-tabs (==2023.4.21)", "sphinxcontrib-applehelp (==1.0.4)", "sphinxcontrib-devhelp (==1.0.2)", "sphinxcontrib-htmlhelp (==2.0.1)", "sphinxcontrib-jsmath (==1.0.1)", "sphinxcontrib-qthelp (==1.0.3)", "sphinxcontrib-serializinghtml (==1.1.5)", "sphinxcontrib-websupport (==1.2.4)", "sphinxcontrib_trio (==1.1.2)", "typing-extensions (>=4.3,<5)"] +speed = ["Brotli", "aiodns (>=1.1)", "cchardet (==2.1.7)", "orjson (>=3.5.4)", "zstandard (>=0.23.0)"] test = ["coverage[toml]", "pytest", "pytest-asyncio", "pytest-cov", "pytest-mock", "typing-extensions (>=4.3,<5)", "tzdata"] voice = ["PyNaCl (>=1.3.0,<1.6)"] @@ -821,4 +865,4 @@ propcache = ">=0.2.0" [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "6b4d35b268bb3ba397f43d223bf90a995e0e43ccff0c8214ebe59f2373c14fb8" +content-hash = "4a34eec40c3465af6f524634350cd9bbe1520f9114c9e5d3937db272b419ae82" diff --git a/pyproject.toml b/pyproject.toml index 186902c..f4367ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ parsedatetime = "^2.6" aiohttp = "^3.9.3" gidgethub = "^5.3.0" async-timeout = "^4.0.2" -"discord.py" = "^2.3.2" +"discord.py" = "^2.5.0" [tool.poetry.dev-dependencies] diff --git a/robocop_ng/__main__.py b/robocop_ng/__main__.py index b724129..6d14cc2 100755 --- a/robocop_ng/__main__.py +++ b/robocop_ng/__main__.py @@ -262,8 +262,7 @@ async def on_message(message: Message): for phrase in config.blocked_phrases.keys(): if phrase in message.content: - await message.channel.send( - content=config.blocked_phrases[phrase]) + await message.channel.send(content=config.blocked_phrases[phrase]) await message.delete() return diff --git a/robocop_ng/cogs/logfilereader.py b/robocop_ng/cogs/logfilereader.py index 7e4b37d..d8c9721 100644 --- a/robocop_ng/cogs/logfilereader.py +++ b/robocop_ng/cogs/logfilereader.py @@ -44,8 +44,13 @@ def is_valid_log_name(attachment: Attachment) -> tuple[bool, bool]: filename = attachment.filename ryujinx_log_file_regex = re.compile(r"^Ryujinx_.*\.log$") log_file = re.compile(r"^.*\.log|.*\.txt$") - is_ryujinx_log_file = re.match(ryujinx_log_file_regex, filename) is not None and "Android" not in filename - is_log_file = re.match(log_file, filename) is not None and "Android" not in filename + is_ryujinx_log_file = ( + re.match(ryujinx_log_file_regex, filename) is not None + and "Android" not in filename + ) + is_log_file = ( + re.match(log_file, filename) is not None and "Android" not in filename + ) return is_log_file, is_ryujinx_log_file @@ -169,7 +174,9 @@ async def blocked_path_action(self, message: Message, blocked_path: str) -> Embe await message.delete() return embed - def format_analysed_log(self, author_name: str, analyser: LogAnalyser, analysed_log): + def format_analysed_log( + self, author_name: str, analyser: LogAnalyser, analysed_log + ): cleaned_game_name = re.sub( r"\s\[(64|32)-bit\]$", "", analysed_log["game_info"]["game_name"] ) @@ -633,7 +640,14 @@ async def analyse_log_message(self, message: Message, attachment_index=0): @commands.cooldown(3, 30, BucketType.channel) @commands.command( - aliases=["analyselog", "analyse_log", "analyze", "analyzelog", "analyze_log", "a"] + aliases=[ + "analyselog", + "analyse_log", + "analyze", + "analyzelog", + "analyze_log", + "a", + ] ) async def analyse(self, ctx: Context, attachment_number=1): await ctx.message.delete() diff --git a/robocop_ng/cogs/logs.py b/robocop_ng/cogs/logs.py index 5465e20..3b6abd6 100644 --- a/robocop_ng/cogs/logs.py +++ b/robocop_ng/cogs/logs.py @@ -19,9 +19,11 @@ message_edited_color = Color.blurple() member_updated_color = Color.blurple() + async def send_log(channel: TextChannel, message: str, color: Color): await channel.send(embed=Embed(description=message, color=color)) + class Logs(Cog): """ Logs join and leave messages, bans and unbans, and member changes. @@ -102,8 +104,7 @@ async def on_member_join(self, member: Member): if age < self.bot.config.min_age: try: await member.send( - f"Your account is too new to " - f"join {member.guild.name}." + f"Your account is too new to " f"join {member.guild.name}." ) sent = True except discord.errors.Forbidden: @@ -216,7 +217,8 @@ async def do_nickcheck(self, message): return msg = ( - f"Rule violating name by {message.author.mention} " f"({message.author.id})." + f"Rule violating name by {message.author.mention} " + f"({message.author.id})." ) spy_channel = self.bot.get_channel(self.bot.config.spylog_channel) @@ -396,7 +398,7 @@ async def on_member_update(self, member_before, member_after): f"ℹ️ **Member update**: {member_after.mention} | " f"{self.bot.escape_message(member_after)}{msg}" ) - await send_log(log_channel, msg,member_updated_color) + await send_log(log_channel, msg, member_updated_color) async def setup(bot): diff --git a/robocop_ng/cogs/verification.py b/robocop_ng/cogs/verification.py index 5d0d6ef..41aaeae 100644 --- a/robocop_ng/cogs/verification.py +++ b/robocop_ng/cogs/verification.py @@ -55,7 +55,7 @@ async def do_reset(self, channel, author, limit: int = 100): else: # we've hit the limit; split! messages += [current_message] - current_message = "\n\u200B\n" + item + "\n\u200B\n" + current_message = "\n\u200b\n" + item + "\n\u200b\n" total = 0 messages += [current_message] diff --git a/robocop_ng/helpers/checks.py b/robocop_ng/helpers/checks.py index 20c255c..099512e 100644 --- a/robocop_ng/helpers/checks.py +++ b/robocop_ng/helpers/checks.py @@ -1,5 +1,6 @@ from robocop_ng import config + def check_if_staff(ctx): if not ctx.guild: return False @@ -35,6 +36,7 @@ def check_if_collaborator(ctx): for r in ctx.author.roles ) + def check_if_pin_channel(ctx): if not ctx.guild: return False diff --git a/robocop_ng/helpers/ryujinx_log_analyser.py b/robocop_ng/helpers/ryujinx_log_analyser.py index e2f00d8..28840b7 100644 --- a/robocop_ng/helpers/ryujinx_log_analyser.py +++ b/robocop_ng/helpers/ryujinx_log_analyser.py @@ -22,6 +22,7 @@ class LogDataError(RuntimeError): def __init__(self, message: str): self.add_note(message) + class RyujinxVersion(IntEnum): STABLE = auto() CANARY = auto() @@ -31,6 +32,7 @@ class RyujinxVersion(IntEnum): MIRROR = auto() CUSTOM = auto() + original_project_version_pattern = re.compile(r"^1\.(0|1)\.\d+$") mainline_version_pattern = re.compile(r"^1\.2\.\d+$") canary_version_pattern = re.compile(r"^c1\.2\.\d+$") @@ -38,6 +40,7 @@ class RyujinxVersion(IntEnum): ldn_version_pattern = re.compile(r"^\d\.\d\.\d-ldn\d+\.\d+(?:\.\d+|$)") mirror_version_pattern = re.compile(r"^r\.(\d|\w){7}$") + class LogAnalyser: _log_text: str _log_errors: list[list[str]] @@ -55,9 +58,7 @@ def is_homebrew(log_file: str) -> bool: @staticmethod def is_using_metal(log_file: str) -> bool: - return ( - re.search("Gpu : Backend \\(Metal\\): Metal", log_file) is not None - ) + return re.search("Gpu : Backend \\(Metal\\): Metal", log_file) is not None @staticmethod def get_filepaths(log_file: str) -> set[str]: @@ -484,7 +485,10 @@ def __get_os_notes(self): "**⚠️ AMD GPU users should consider using Vulkan graphics backend.**" ) - if "macOS" in self._hardware_info["os"] and "Intel" in self._hardware_info["cpu"]: + if ( + "macOS" in self._hardware_info["os"] + and "Intel" in self._hardware_info["cpu"] + ): self._notes.add("**⚠️ Intel Macs are not supported.**") def __get_cpu_notes(self): @@ -525,10 +529,10 @@ def __get_settings_notes(self): if self._settings["shader_cache"] == "Disabled": self._notes.add("🔴 **Shader cache should be enabled.**") - if (self._settings["expand_ram"] is not None) and "4K" not in self._game_info["mods"]: - self._notes.add( - "⚠️ `DRAM size` should only be increased for 4K mods." - ) + if (self._settings["expand_ram"] is not None) and "4K" not in self._game_info[ + "mods" + ]: + self._notes.add("⚠️ `DRAM size` should only be increased for 4K mods.") if self._settings["memory_manager"] == "SoftwarePageTable": self._notes.add( @@ -632,18 +636,26 @@ def __get_notes(self): self.__get_settings_notes() if LogAnalyser.is_using_metal(self._log_text): - self._notes.add("**⚠️ The Metal backend is experimental. If you're experiencing issues, switch to Vulkan or Auto.**") + self._notes.add( + "**⚠️ The Metal backend is experimental. If you're experiencing issues, switch to Vulkan or Auto.**" + ) version_type = self.get_ryujinx_version()[0] if version_type == RyujinxVersion.CUSTOM: self._notes.add("**⚠️ Custom builds are not officially supported**") elif version_type == RyujinxVersion.ORIGINAL_PROJECT_LDN: - raise LogDataError("**The old Ryujinx LDN build no longer works. Please update to [this version](). *Yes, it has LDN functionality.***") + raise LogDataError( + "**The old Ryujinx LDN build no longer works. Please update to [this version](). *Yes, it has LDN functionality.***" + ) elif version_type == RyujinxVersion.ORIGINAL_PROJECT: - raise LogDataError("**⚠️ It seems you're still using the original Ryujinx. Please update to [this version](), as that's what this Discord server is for.**") + raise LogDataError( + "**⚠️ It seems you're still using the original Ryujinx. Please update to [this version](), as that's what this Discord server is for.**" + ) elif version_type == RyujinxVersion.MIRROR: - raise LogDataError("**It seems you're using the other Ryujinx fork, ryujinx-mirror. Please update to [this version](), as that's what this Discord server is for; or go to their Discord server for support.**") + raise LogDataError( + "**It seems you're using the other Ryujinx fork, ryujinx-mirror. Please update to [this version](), as that's what this Discord server is for; or go to their Discord server for support.**" + ) def get_ryujinx_version(self) -> tuple[RyujinxVersion, str]: version_data = self._emu_info["ryu_version"] @@ -651,7 +663,7 @@ def get_ryujinx_version(self) -> tuple[RyujinxVersion, str]: if re.match(mainline_version_pattern, version_data): return RyujinxVersion.STABLE, version_data elif re.match(canary_version_pattern, version_data): - return RyujinxVersion.CANARY, version_data.lstrip('c') + return RyujinxVersion.CANARY, version_data.lstrip("c") if re.match(original_project_version_pattern, version_data): return RyujinxVersion.ORIGINAL_PROJECT, version_data elif re.match(pr_version_pattern, version_data):