From de96ea70933ddf6940eba3abed35455ad0e19a8b Mon Sep 17 00:00:00 2001 From: Sam <100821827+01101sam@users.noreply.github.com> Date: Mon, 11 Jul 2022 07:23:51 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20PMC=20-=20Fix=20report=20not=20e?= =?UTF-8?q?nabled=20by=20default=20(v2.24)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- list.json | 2 +- pmcaptcha/main.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/list.json b/list.json index 10767a2..126cb08 100644 --- a/list.json +++ b/list.json @@ -72,7 +72,7 @@ }, { "name": "pmcaptcha", - "version": "2.23", + "version": "2.24", "section": "chat", "maintainer": "cloudreflection,01101sam", "size": "2.1k line", diff --git a/pmcaptcha/main.py b/pmcaptcha/main.py index 310c743..31e1015 100644 --- a/pmcaptcha/main.py +++ b/pmcaptcha/main.py @@ -710,7 +710,7 @@ class Command: """ if not toggle: return await self._display_value( - display_text=lang('report_curr_rule') % lang('enabled' if setting.get('report') else 'disabled'), + display_text=lang('report_curr_rule') % lang('enabled' if setting.get('report', True) else 'disabled'), sub_cmd="report", value_type="vocab_bool") await self._set_toggle("report", toggle, reverse=True) @@ -1592,7 +1592,7 @@ class CaptchaChallenge: user.dc_id and caption.append(f"DC: {code(str(user.dc_id))}") user.phone_number and caption.append(f"Phone: {code(user.phone_number)}") self.type and caption.append(f"Type: {code(self.type)}") - self.can_report and setting.get("report") and caption.append(f"Spam Reported: {code('Yes')}") + self.can_report and setting.get("report", True) and caption.append(f"Spam Reported: {code('Yes')}") ban_code and caption.append(f"Block Reason: {code(ban_code)}") self.captcha_start and caption.append(f"Start: {code(str(self.captcha_start))}") self.captcha_end and caption.append(f"End: {code(str(self.captcha_end))}") @@ -1667,7 +1667,7 @@ class CaptchaChallenge: try: for challenge_msg_id in self.challenge_msg_ids: await bot.delete_messages(self.user.id, challenge_msg_id) - (self.can_report and setting.get("report") and + (self.can_report and setting.get("report", True) and await bot.invoke(messages.ReportSpam(peer=await bot.resolve_peer(self.user.id)))) except Exception as e: console.debug(f"Error occurred when executing verify failed function: {e}\n{traceback.format_exc()}")