🐛 PMC - Fix report not enabled by default (v2.24)

This commit is contained in:
Sam 2022-07-11 07:23:51 +08:00 committed by GitHub
parent beaf136be0
commit de96ea7093
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -72,7 +72,7 @@
}, },
{ {
"name": "pmcaptcha", "name": "pmcaptcha",
"version": "2.23", "version": "2.24",
"section": "chat", "section": "chat",
"maintainer": "cloudreflection,01101sam", "maintainer": "cloudreflection,01101sam",
"size": "2.1k line", "size": "2.1k line",

View File

@ -710,7 +710,7 @@ class Command:
""" """
if not toggle: if not toggle:
return await self._display_value( 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", sub_cmd="report",
value_type="vocab_bool") value_type="vocab_bool")
await self._set_toggle("report", toggle, reverse=True) 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.dc_id and caption.append(f"DC: {code(str(user.dc_id))}")
user.phone_number and caption.append(f"Phone: {code(user.phone_number)}") user.phone_number and caption.append(f"Phone: {code(user.phone_number)}")
self.type and caption.append(f"Type: {code(self.type)}") 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)}") 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_start and caption.append(f"Start: {code(str(self.captcha_start))}")
self.captcha_end and caption.append(f"End: {code(str(self.captcha_end))}") self.captcha_end and caption.append(f"End: {code(str(self.captcha_end))}")
@ -1667,7 +1667,7 @@ class CaptchaChallenge:
try: try:
for challenge_msg_id in self.challenge_msg_ids: for challenge_msg_id in self.challenge_msg_ids:
await bot.delete_messages(self.user.id, challenge_msg_id) 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)))) await bot.invoke(messages.ReportSpam(peer=await bot.resolve_peer(self.user.id))))
except Exception as e: except Exception as e:
console.debug(f"Error occurred when executing verify failed function: {e}\n{traceback.format_exc()}") console.debug(f"Error occurred when executing verify failed function: {e}\n{traceback.format_exc()}")