Skip to content
This repository was archived by the owner on Jun 3, 2021. It is now read-only.
/ hutool-qq Public archive

基于Hutool和WebQQ-API实现的QQ API封装。

License

Notifications You must be signed in to change notification settings

chinabugotech/hutool-qq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d7ccafe · Dec 2, 2018

History

11 Commits
Jul 28, 2018
Jul 28, 2018
Jul 29, 2018
Dec 2, 2018
Jul 28, 2018
Jul 28, 2018
Jul 30, 2018
Dec 2, 2018

Repository files navigation

A QQ java sdk power by Hutool

Gitee主页:https://gitee.com/loolly/hutool-qq
QQ群:384355290


简介

基于Hutool和WebQQ-API实现的QQ API封装,功能包括:

  • 登录QQ(二维码登录)
  • 接收消息(好友消息、群消息、讨论组消息)
  • 发送消息(好友消息、群消息、讨论组消息)
  • 获取当前登录用户信息
  • 获取所有好友信息,包括分组信息
  • 获取群信息(包括群成员列表)
  • 获取讨论组信息(包括讨论组成员信息)
  • 根据好友ID获取好友的QQ号码

运行

final QQClient client = new QQClient();
client.loopPollMessage(new SplitMessageListener() {
	
	@Override
	public void onGroupMessage(GroupMessage message) {
		//接收群消息
		String content = message.getContent();
		Console.log("[{}][{}] {}", message.getUserId(), DateUtil.date(message.getTime()).toTimeStr(), message.getContent());
	}
	
	@Override
	public void onFriendMessage(FriendMessage message) {
		//接收好友消息
		Console.log("[{}][{}] {}", message.getUserId(), DateUtil.date(message.getTime()).toTimeStr(), message.getContent());
		
	}
	
	@Override
	public void onDiscussMessage(DiscussMessage message) {
		//接收讨论组消息
		Console.log("[{}][{}] {}", message.getUserId(), DateUtil.date(message.getTime()).toTimeStr(), message.getContent());
	}
});

//获取分组以及分组下的好友列表
Collection<Category> friendsByCategory = client.getFriendsByCategory();
for (Category category : friendsByCategory) {
	Console.log(category);
	for (Friend friend : category.getFriends()) {
		Console.log("-- {}", friend.getNickname());
	}
}

运行后提示:

二维码保存于:[XXX\hutool-qq\target\test-classes\qrcode.png],请打开手机QQ扫描登录。

打开地址对应的图片,使用手机QQ扫描即可。

感谢

WebQQ API全部来自Smart QQ Java项目,部分逻辑思想有参考。

About

基于Hutool和WebQQ-API实现的QQ API封装。

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published