Skip to content

Commit

Permalink
v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Guo committed Aug 30, 2021
1 parent d348e54 commit ea7b329
Show file tree
Hide file tree
Showing 16 changed files with 503 additions and 171 deletions.
21 changes: 9 additions & 12 deletions .idea/artifacts/OPQ4J_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added out/artifacts/OPQ4J_jar/OPQ4J.jar
Binary file not shown.
3 changes: 0 additions & 3 deletions src/META-INF/MANIFEST.MF

This file was deleted.

57 changes: 0 additions & 57 deletions src/main/java/Core.kt

This file was deleted.

31 changes: 29 additions & 2 deletions src/main/java/JMain.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,41 @@
import core.Core;
import listener.OPQListener;
import org.jetbrains.annotations.NotNull;

public class JMain {
public static void main(String[] args) {
Core core = new Core("http://118.178.178.211",2233,2056378490);
core.start(new OPQListener(){
//服务器地址、端口、机器人QQ
Core core = new Core("http://xxx.xxx.xxx.xxx", 2233, 1000000000);
/*设置发送消息的最小间隔时间,默认为1000ms
由于服务器响应速度等问题,间隔时间过小可能导致消息丢失*/
//core.setDelay(500);
//1.通过重写OPQListener中的方法进行监听
//我只实现了部分消息监听
core.start(new OPQListener() {
@Override
public void onPrivateTextMsg(long toQQ, @NotNull String textContent) {
super.onPrivateTextMsg(toQQ, textContent);
/*
Core提供了4个发送消息的方法,详见源码中的注释
1.sendPrivateMsg
2.sendGroupMsg
3.sendGroupMsgWithAt
4.sendMsg 通过路径和参数调用所有服务端的接口
*/
core.sendPrivateMsg(toQQ, textContent);
//使用sendMsg方法时需要注意带'\'的需要将'\'转义,例如:
//'\n'->'\\n' '\"'->'\\\"'
String nContent = "\\\"a\\nb\\n";
core.sendMsg("/v1/LuaApiCaller?qq=" + Core.Companion.getCurrentQQ() + "&funcname=SendMsg&timeout=10",
"{\"toUser\":" + toQQ + ",\"sendToType\":1,\"sendMsgType\":\"TextMsg\",\"content\":\"" + nContent + "\",\"groupid\":0,\"atUser\":0}");
}
});
//2.可参考OPQListener通过继承OPQBaseListener实现自己的Listener进行监听
// core.start(new OPQBaseListener(){
// @Override
// public void onPrivateMsg(@NotNull String rawMsg) {
// System.out.println(rawMsg);
// }
// });
}
}
36 changes: 36 additions & 0 deletions src/main/java/KMain.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import core.Core
import listener.OPQListener

fun main() {
//服务器地址、端口、机器人QQ
val core = Core("http://xxx.xxx.xxx.xxx", 2233, 1000000000)
/*设置发送消息的最小间隔时间,默认为1000ms
由于服务器响应速度等问题,间隔时间过小可能导致消息丢失*/
//core.setDelay(500);
//1.通过重写OPQListener中的方法进行监听
//我只实现了部分消息监听
core.start(object : OPQListener() {
override fun onPrivateTextMsg(toQQ: Long, textContent: String) {
super.onPrivateTextMsg(toQQ, textContent)
/*
Core提供了4个发送消息的方法,详见源码中的注释
1.sendPrivateMsg
2.sendGroupMsg
3.sendGroupMsgWithAt
4.sendMsg 通过路径和参数调用所有服务端的接口
*/
core.sendPrivateMsg(toQQ, textContent)
//使用sendMsg方法时需要注意带'\'的需要将'\'转义,例如:
//'\n'->'\\n' '\"'->'\\\"'
val nContent = "\\\"a\\nb\\n"
core.sendMsg("/v1/LuaApiCaller?qq=${Core.currentQQ}&funcname=SendMsg&timeout=10",
"""{"toUser":$toQQ,"sendToType":1,"sendMsgType":"TextMsg","content":"$nContent","groupid":0,"atUser":0}""")
}
})
//2.可参考OPQListener通过继承OPQBaseListener实现自己的Listener进行监听
// core.start(object : OPQBaseListener() {
// override fun onPrivateMsg(rawMsg: String) {
// println(rawMsg)
// }
// })
}
56 changes: 0 additions & 56 deletions src/main/java/OPQListener.kt

This file was deleted.

6 changes: 0 additions & 6 deletions src/main/java/constant/OPQConfig.kt

This file was deleted.

Loading

0 comments on commit ea7b329

Please sign in to comment.