Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
109 additions
and
22 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
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ examples/ | |
## 环境安装 | ||
|
||
``` bash | ||
pip install qq-bot | ||
pip install qq-botpy | ||
``` | ||
|
||
## 使用方法 | ||
|
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,50 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
import os.path | ||
from typing import List | ||
|
||
import botpy | ||
from botpy.message import Message | ||
from botpy.types import reaction | ||
from botpy.types.user import User | ||
from botpy.utils import YamlUtil | ||
|
||
test_config = YamlUtil.read(os.path.join(os.path.dirname(__file__), "config.yaml")) | ||
|
||
|
||
class MyClient(botpy.Client): | ||
async def on_at_message_create(self, message: Message): | ||
users: List[User] = [] | ||
cookie = "" | ||
while True: | ||
reactionUsers: reaction.ReactionUsers = await self.api.get_reaction_users( | ||
"2568610", | ||
"088de19cbeb883e7e97110a2e39c0138d80d48acfc879406", | ||
1, | ||
"4", | ||
cookie=cookie, | ||
) | ||
|
||
if not reactionUsers: | ||
break | ||
|
||
users.extend(reactionUsers["users"]) | ||
|
||
if reactionUsers["is_end"]: | ||
break | ||
else: | ||
cookie = reactionUsers["cookie"] | ||
|
||
print(len(users)) | ||
for user in users: | ||
print(user["username"]) | ||
|
||
|
||
if __name__ == "__main__": | ||
# 通过预设置的类型,设置需要监听的事件通道 | ||
# intents = botpy.Intents.none() | ||
# intents.public_guild_messages=True | ||
# 通过kwargs,设置需要监听的事件通道 | ||
intents = botpy.Intents(public_guild_messages=True) | ||
client = MyClient(intents) | ||
client.run(appid=test_config["appid"], token=test_config["token"]) |
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