Skip to content

求问如何主动向群聊/用户发送消息 #29

Answered by Yukari316
lightningmaker asked this question in Q&A
Discussion options

You must be logged in to vote

可以尝试将 SoraApi 这个实例保存下来然后在之后的定时业务中调用实例中的API(比如塞进容器里之类的)
比如 用 SendGroupMessage 来发送一些要主动发送的消息
框架在处理几乎所有的上报事件的时候都会创建一个 SoraApi 实例来给上层API使用
SoraApi 也提供���几乎所有的底层API方法
需要注意的是 SoraApi 是对单一连接单一服务所创建的实例,所以在 SoraApi 所对应的服务连接失效后,实例中的API也均会失效,这一个需要注意

不过后续版本应该会提供一个动态创建 SoraApi 实例的方法以供定时任务需要,不过这个东西还在后续的架构考虑之中应该不会太快去支持

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by lightningmaker
Comment options

You must be logged in to vote
1 reply
@Yukari316
Comment options

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