mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-25 10:02:23 +00:00
forcesubscribe 修复无法识别用户的问题
This commit is contained in:
parent
e932e9e711
commit
9c01f3f2ca
@ -26,7 +26,11 @@ async def force_subscribe_join(event: ChatAction.Event):
|
|||||||
if redis.get(f"sub.chat_id.{event.chat_id}.{user.id}"):
|
if redis.get(f"sub.chat_id.{event.chat_id}.{user.id}"):
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
await bot(GetParticipantRequest(join_chat, user.id))
|
try:
|
||||||
|
await bot(GetParticipantRequest(join_chat, user.id))
|
||||||
|
except ValueError:
|
||||||
|
user_input = await event.get_input_user()
|
||||||
|
await bot(GetParticipantRequest(join_chat, user_input))
|
||||||
redis.set(f'sub.chat_id.{event.chat_id}.{user.id}', 'true')
|
redis.set(f'sub.chat_id.{event.chat_id}.{user.id}', 'true')
|
||||||
redis.expire(f'sub.chat_id.{event.chat_id}.{user.id}', 3600)
|
redis.expire(f'sub.chat_id.{event.chat_id}.{user.id}', 3600)
|
||||||
except UserNotParticipantError:
|
except UserNotParticipantError:
|
||||||
@ -51,7 +55,11 @@ async def force_subscribe_msg(context: Message):
|
|||||||
if context.sender.bot:
|
if context.sender.bot:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
await bot(GetParticipantRequest(join_chat, context.sender_id))
|
try:
|
||||||
|
await bot(GetParticipantRequest(join_chat, context.sender_id))
|
||||||
|
except ValueError:
|
||||||
|
await bot.get_participants(context.chat)
|
||||||
|
await bot(GetParticipantRequest(join_chat, context.sender_id))
|
||||||
redis.set(f'sub.chat_id.{context.chat_id}.{context.sender_id}', 'true')
|
redis.set(f'sub.chat_id.{context.chat_id}.{context.sender_id}', 'true')
|
||||||
redis.expire(f'sub.chat_id.{context.chat_id}.{context.sender_id}', 3600)
|
redis.expire(f'sub.chat_id.{context.chat_id}.{context.sender_id}', 3600)
|
||||||
except UserNotParticipantError:
|
except UserNotParticipantError:
|
||||||
|
Loading…
Reference in New Issue
Block a user