-
Notifications
You must be signed in to change notification settings - Fork 29
feat: support get_friend_list #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
02f9aec
feat: support get_friend_list
Decrabbityyy 8e519c0
fix null data
Decrabbityyy 837af26
Resolved conflicts
Decrabbityyy a16995e
Merge pull request #1 from Decrabbityyy/feat/get_friend_list
Decrabbityyy 5dd6a0d
add BotFriend
Decrabbityyy 022abed
fix typo
Decrabbityyy b842f19
standardized naming
Decrabbityyy 3ada3ea
standardized naming (again)
Decrabbityyy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,76 @@ | ||
| from typing import List, Optional, Union | ||
|
|
||
| from lagrange.utils.binary.protobuf import ProtoStruct, proto_field | ||
|
|
||
|
|
||
| class FriendProperty(ProtoStruct): | ||
| code: int = proto_field(1) | ||
| value: Optional[str] = proto_field(2, default=None) | ||
|
|
||
|
|
||
| class FriendLayer1(ProtoStruct): | ||
| properties: List[FriendProperty] = proto_field(2, default=None) | ||
|
|
||
|
|
||
| class FriendAdditional(ProtoStruct): | ||
| type: int = proto_field(1) | ||
| layer1: FriendLayer1 = proto_field(2) | ||
|
|
||
|
|
||
| class FriendInfo(ProtoStruct): | ||
| uid: str = proto_field(1) | ||
| custom_group: Optional[int] = proto_field(2, default=None) | ||
| uin: int = proto_field(3) | ||
| additional: List[FriendAdditional] = proto_field(10001) | ||
|
|
||
|
|
||
| class GetFriendNumbers(ProtoStruct): | ||
| f1: List[int] = proto_field(1) | ||
|
|
||
|
|
||
| class GetFriendBody(ProtoStruct): | ||
| type: int = proto_field(1) | ||
| f2: GetFriendNumbers = proto_field(2) | ||
|
|
||
|
|
||
| class GetFriendListUin(ProtoStruct): | ||
| uin: int = proto_field(1) | ||
|
|
||
|
|
||
| class PBGetFriendListRequest(ProtoStruct): | ||
| friend_count: int = proto_field(2, default=300) # paging get num | ||
| f4: int = proto_field(4, default=0) | ||
| next_uin: Optional[GetFriendListUin] = proto_field(5, default=None) | ||
| f6: int = proto_field(6, default=1) | ||
| f7: int = proto_field(7, default=2147483647) # MaxValue | ||
| body: List[GetFriendBody] = proto_field( | ||
| 10001, | ||
| default=[ | ||
| GetFriendBody(type=1, f2=GetFriendNumbers(f1=[103, 102, 20002, 27394])), | ||
| GetFriendBody(type=4, f2=GetFriendNumbers(f1=[100, 101, 102])), | ||
| ], | ||
| ) | ||
| f10002: List[int] = proto_field(10002, default=[13578, 13579, 13573, 13572, 13568]) | ||
| f10003: int = proto_field(10003, default=4051) | ||
| """ | ||
| * GetFriendNumbers里是要拿到的东西 | ||
| * 102:个性签名 | ||
| * 103:备注 | ||
| * 20002:昵称 | ||
| * 27394:QID | ||
| """ | ||
|
|
||
|
|
||
| class GetFriendListRsp(ProtoStruct): | ||
| next: Optional[GetFriendListUin] = proto_field(2, default=None) | ||
| display_friend_count: int = proto_field(3) | ||
| timestamp: int = proto_field(6) | ||
| self_uin: int = proto_field(7) | ||
| friend_list: List[FriendInfo] = proto_field(101) | ||
|
|
||
|
|
||
| def propertys(properties: Union[List[FriendProperty], None]): | ||
| if properties is None: | ||
| return {} | ||
| prop_dict = dict((prop.code, prop.value) for prop in properties) | ||
| return prop_dict | ||
Decrabbityyy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.