mirai-core / net.mamoe.mirai.contact / Group / sendMessage

sendMessage

abstract suspend fun sendMessage(message: Message): MessageReceipt<Group>

向这个对象发送消息.

单条消息最大可发送 4500 字符或 50 张图片.

Exceptions

EventCancelledException - 当发送消息事件被取消时抛出

BotIsBeingMutedException - 发送群消息时若 Bot 被禁言抛出

MessageTooLargeException - 当消息过长时抛出

IllegalArgumentException - 当消息内容为空时抛出 (详见 Message.isContentEmpty)

See Also

FriendMessageSendEvent

GroupMessageSendEvent

Return
消息回执. 可进行撤回 (MessageReceipt.recall)

suspend fun sendMessage(message: String): MessageReceipt<Group>

See Also

sendMessage