Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [feat]sdk异步化,重构session pool逻辑 * [feat]sdk异步化,新增async模块增加异步的逻辑 * [feat]sdk异步化,增加一些错误处理 * [feat]sdk异步化,增加一些错误处理 * [feat]sdk异步化,完成websocket的部分 * [feat]sdk异步化,完成websocket的部分 * [feat]sdk异化,完成http部分 * [fix]sdk异步化,删除loop.close * [fix]sdk异步化,重构代码目录 * [feat]sdk异步化,增加一些错误处理 * [fix]sdk异步化,新增async api模块,增加单元测试 * [feat]sdk异步化,删除loop.close * [feat]sdk异步化,重构代码目录 * [feat]sdk异步化,增加一些错误处理 * [feat]sdk异步化,新增async api模块,增加单元测试 * [feat]sdk异步化,修改文档 * [feat]sdk异步化,解决内存泄漏的问题 * [feat]sdk异步化,解决内存泄漏的问题 * [feat]sdk异步化,解决内存泄漏的问题 * [feat]sdk异步化,解决链接超过一定时间失败的问题 * [fix]增加异步ws断连的问题 * [doc]修改setup的项目地址和描述 Co-authored-by: veehou <veehou@tencent.com> Co-authored-by: chukuanli <chukuanli@tencent.com>
- Loading branch information
1 parent
f9f9962
commit 44473de
Showing
37 changed files
with
2,250 additions
and
623 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
import asyncio | ||
import os.path | ||
|
||
import qqbot | ||
from qqbot.core.util.yaml_util import YamlUtil | ||
|
||
test_config = YamlUtil.read(os.path.join(os.path.dirname(__file__), "config.yaml")) | ||
|
||
|
||
async def _message_handler(event, message: qqbot.Message): | ||
""" | ||
定义事件回调的处理 | ||
:param event: 事件类型 | ||
:param message: 事件对象(如监听消息是Message对象) | ||
""" | ||
msg_api = qqbot.AsyncMessageAPI(t_token, False) | ||
# 打印返回信息 | ||
qqbot.logger.info("event %s" % event + ",receive message %s" % message.content) | ||
for i in range(5): | ||
await asyncio.sleep(5) | ||
# 构造消息发送请求数据对象 | ||
send = qqbot.MessageSendRequest("<@%s>谢谢你,加油 " % message.author.id, message.id) | ||
# 通过api发送回复消息 | ||
await msg_api.post_message(message.channel_id, send) | ||
|
||
|
||
if __name__ == "__main__": | ||
# async的异步接口的使用示例 | ||
t_token = qqbot.Token(test_config["token"]["appid"], test_config["token"]["token"]) | ||
qqbot_handler = qqbot.Handler( | ||
qqbot.HandlerType.AT_MESSAGE_EVENT_HANDLER, _message_handler | ||
) | ||
qqbot.async_listen_events(t_token, False, qqbot_handler) |
Oops, something went wrong.