58 lines
2.4 KiB
Java
58 lines
2.4 KiB
Java
package com.yutou.napcat;
|
|
|
|
import com.yutou.napcat.handle.MessageHandleBuild;
|
|
import com.yutou.napcat.handle.Text;
|
|
import com.yutou.napcat.http.NapCatApi;
|
|
import com.yutou.napcat.model.SendMessageResponse;
|
|
import com.yutou.okhttp.HttpCallback;
|
|
import okhttp3.Headers;
|
|
|
|
import java.io.File;
|
|
|
|
public class NapCatQQ {
|
|
|
|
|
|
private NapCatQQ() {
|
|
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
/* List<BaseHandle<?>> list = new ArrayList<>();
|
|
list.add(new Text("1", false));
|
|
list.add(new Text("2", false));
|
|
list.add(new Text("3"));
|
|
list.add(new Text("4", false));
|
|
list.add(new At(583819556L));
|
|
list.add(new Text("5"));
|
|
QQBotManager.getInstance().sendMessage(false, 891655174L, list);*/
|
|
NapCatApi.setLog(false);
|
|
File file = new File("C:\\Users\\58381\\Downloads\\0074TT8Yly1hp5mqidwqeg30g20f27wh.gif");
|
|
NapCatApi.getMessageApi().sendPrivateMsg(
|
|
MessageHandleBuild.create()
|
|
.setQQNumber(583819556L)
|
|
//.add(new Image(file))
|
|
.add(new Text("abc"))
|
|
.build()
|
|
).enqueue(new HttpCallback<SendMessageResponse>() {
|
|
@Override
|
|
public void onResponse(Headers headers, int code, String status, SendMessageResponse response, String rawResponse) {
|
|
System.out.println("code = " + code + ", status = " + status + ", response = " + response + ", rawResponse = " + rawResponse);
|
|
}
|
|
|
|
@Override
|
|
public void onFailure(Throwable throwable) {
|
|
throwable.printStackTrace();
|
|
}
|
|
});
|
|
}
|
|
/**
|
|
* 私聊
|
|
{"self_id":240828363,"user_id":583819556,"time":1714472684,"message_id":376,"real_id":376,"message_type":"private","sender":{"user_id":583819556,"nickname":"魔芋","card":""},"raw_message":"123","font":14,"sub_type":"friend","message":[{"data":{"text":"123"},"type":"text"}],"message_format":"array","post_type":"message"}
|
|
*/
|
|
|
|
/**
|
|
* 群聊
|
|
* {"self_id":240828363,"user_id":583819556,"time":1714472695,"message_id":377,"real_id":377,"message_type":"group","sender":{"user_id":583819556,"nickname":"魔芋","card":"","role":"owner"},"raw_message":"222","font":14,"sub_type":"normal","message":[{"data":{"text":"222"},"type":"text"}],"message_format":"array","post_type":"message","group_id":891655174}
|
|
*/
|
|
}
|