🐛 PMCaptcha - Fix user_id bug

This commit is contained in:
Sam 2022-07-03 10:46:41 +08:00 committed by GitHub
parent ae27cbceba
commit 00c1ebe7b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -72,7 +72,7 @@
}, },
{ {
"name": "pmcaptcha", "name": "pmcaptcha",
"version": "2.1", "version": "2.101",
"section": "chat", "section": "chat",
"maintainer": "cloudreflection,01101sam", "maintainer": "cloudreflection,01101sam",
"size": "54.6 kb", "size": "54.6 kb",

View File

@ -813,6 +813,11 @@ class Command:
if not user_id and not self.msg.reply_to_message_id and self.msg.chat.type != ChatType.PRIVATE: if not user_id and not self.msg.reply_to_message_id and self.msg.chat.type != ChatType.PRIVATE:
await self.msg.edit(lang('tip_run_in_pm'), parse_mode=ParseMode.HTML) await self.msg.edit(lang('tip_run_in_pm'), parse_mode=ParseMode.HTML)
return return
try:
if int(user_id) < 0:
return
except ValueError:
pass
user = None user = None
user_id = user_id or self.msg.reply_to_message_id or ( user_id = user_id or self.msg.reply_to_message_id or (
self.msg.chat.type == ChatType.PRIVATE and self.msg.chat.id or 0) self.msg.chat.type == ChatType.PRIVATE and self.msg.chat.id or 0)