mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-16 04:35:49 +00:00
🐛 Fix get_chat parse args
This commit is contained in:
parent
d58ddedd07
commit
c1ed010cb0
@ -82,8 +82,11 @@ class GetChat(Plugin):
|
||||
|
||||
def get_chat_id(self, context: "ContextTypes.DEFAULT_TYPE") -> Optional[int]:
|
||||
args = self.get_args(context)
|
||||
if args and len(args) > 1 and args[0].isnumeric():
|
||||
return int(args[0])
|
||||
if args:
|
||||
try:
|
||||
return int(args[0])
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def gen_button(chat_id: int) -> "InlineKeyboardMarkup":
|
||||
|
@ -57,8 +57,11 @@ class GroupManage(Plugin):
|
||||
|
||||
def get_chat_id(self, context: "ContextTypes.DEFAULT_TYPE") -> Optional[int]:
|
||||
args = self.get_args(context)
|
||||
if args and len(args) > 1 and args[0].isnumeric():
|
||||
return int(args[0])
|
||||
if args:
|
||||
try:
|
||||
return int(args[0])
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
async def add_block_group(self, chat_id: int):
|
||||
group = await self.group_service.get_group_by_id(chat_id)
|
||||
|
Loading…
Reference in New Issue
Block a user