mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 09:05:04 +08:00
🐛 fix error guess when reply to event #136
This commit is contained in:
parent
822709ceeb
commit
a4cb7f13be
@ -421,19 +421,19 @@ class Bot(BaseBot):
|
|||||||
message = escape(message) if isinstance(message, str) else message
|
message = escape(message) if isinstance(message, str) else message
|
||||||
msg = message if isinstance(message, Message) else Message(message)
|
msg = message if isinstance(message, Message) else Message(message)
|
||||||
|
|
||||||
at_sender = at_sender and hasattr(event, "user_id")
|
at_sender = at_sender and getattr(event, "user_id", None)
|
||||||
|
|
||||||
params = {}
|
params = {}
|
||||||
if hasattr(event, "user_id"):
|
if getattr(event, "user_id", None):
|
||||||
params["user_id"] = getattr(event, "user_id")
|
params["user_id"] = getattr(event, "user_id")
|
||||||
if hasattr(event, "group_id"):
|
if getattr(event, "group_id", None):
|
||||||
params["group_id"] = getattr(event, "group_id")
|
params["group_id"] = getattr(event, "group_id")
|
||||||
params.update(kwargs)
|
params.update(kwargs)
|
||||||
|
|
||||||
if "message_type" not in params:
|
if "message_type" not in params:
|
||||||
if "group_id" in params:
|
if params.get("group_id", None):
|
||||||
params["message_type"] = "group"
|
params["message_type"] = "group"
|
||||||
elif "user_id" in params:
|
elif params.get("user_id", None):
|
||||||
params["message_type"] = "private"
|
params["message_type"] = "private"
|
||||||
else:
|
else:
|
||||||
raise ValueError("Cannot guess message type to reply!")
|
raise ValueError("Cannot guess message type to reply!")
|
||||||
|
Loading…
Reference in New Issue
Block a user