Giter Club home page Giter Club logo

hutool-qq's Introduction

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项目,部分逻辑**有参考。

hutool-qq's People

Contributors

looly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.