Skip to content

如何实现atMe触发功能? #1092

Answered by ryoii
AdorableParker asked this question in Q&A
Discussion options

You must be logged in to vote
bot.eventChannel.subscribeGroupMessages(priority = EventPriority.LOWEST) {
    atBot {
        // TODO
    }
}

关于 atBot

@MessageDsl
public fun atBot(onEvent: @MessageDsl suspend M.(String) -> R): Ret =
    content { message.firstIsInstanceOrNull<At>()?.target == bot.id }.invoke {
        onEvent.invoke(this, message.contentToString())
    }

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@sandtechnology
Comment options

@ryoii
Comment options

@AdorableParker
Comment options

@Karlatemp
Comment options

@AdorableParker
Comment options

Answer selected by AdorableParker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants