-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Guo
committed
Aug 30, 2021
1 parent
d348e54
commit ea7b329
Showing
16 changed files
with
503 additions
and
171 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -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); | ||
// } | ||
// }); | ||
} | ||
} |
This file contains 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,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) | ||
// } | ||
// }) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.