mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-12 06:56:41 +00:00
Improve message sending APIs
This commit is contained in:
@ -11,7 +11,20 @@ class BaseSession:
|
||||
self.ctx = ctx
|
||||
|
||||
async def send(self, message: Message_T, *,
|
||||
ignore_failure: bool = True) -> None:
|
||||
"""Send a message ignoring failure by default."""
|
||||
at_sender: bool = False,
|
||||
ensure_private: bool = False,
|
||||
ignore_failure: bool = True,
|
||||
**kwargs) -> None:
|
||||
"""
|
||||
Send a message ignoring failure by default.
|
||||
|
||||
:param message: message to send
|
||||
:param at_sender: @ the sender if in group or discuss chat
|
||||
:param ensure_private: ensure the message is sent to private chat
|
||||
:param ignore_failure: if any CQHttpError raised, ignore it
|
||||
:return: the result returned by CQHTTP
|
||||
"""
|
||||
return await send(self.bot, self.ctx, message,
|
||||
ignore_failure=ignore_failure)
|
||||
at_sender=at_sender,
|
||||
ensure_private=ensure_private,
|
||||
ignore_failure=ignore_failure, **kwargs)
|
||||
|
Reference in New Issue
Block a user