mirror of
https://github.com/Eyre-S/Coeur-Morny-Cono.git
synced 2024-11-22 19:24:53 +08:00
启动器支持以选项方式为 token 和 username 赋值
This commit is contained in:
parent
12b4c91829
commit
ee30b0a0ff
@ -1,6 +1,6 @@
|
||||
## Core
|
||||
|
||||
VERSION = 0.4.2.2
|
||||
VERSION = 0.4.2.3
|
||||
|
||||
# dependencies
|
||||
|
||||
|
@ -4,6 +4,6 @@ package cc.sukazyo.cono.morny;
|
||||
* the final field that will be updated by gradle automatically.
|
||||
*/
|
||||
public class GradleProjectConfigures {
|
||||
public static final String VERSION = "0.4.2.2";
|
||||
public static final long COMPILE_TIMESTAMP = 1639541150226L;
|
||||
public static final String VERSION = "0.4.2.3";
|
||||
public static final long COMPILE_TIMESTAMP = 1639543312227L;
|
||||
}
|
||||
|
@ -35,6 +35,13 @@ public class ServerMain {
|
||||
* 不要同时使用 {@code --no-hello},原因见下。
|
||||
* </li>
|
||||
* <li>
|
||||
* {@code --token} <b>主程序模式的必选项</b><br>
|
||||
* 用于 bot 启动的 telegram bot api token
|
||||
* </li>
|
||||
* <li>
|
||||
* {@code --username} {@link MornyCoeur#getUsername() bot 的 username} 预定义
|
||||
* </li>
|
||||
* <li>
|
||||
* {@code --no-hello} 不在主程序启动时输出用于欢迎消息的字符画。
|
||||
* 与 {@code --only-hello} 参数不兼容 —— 会导致程序完全没有任何输出
|
||||
* </li>
|
||||
@ -44,7 +51,13 @@ public class ServerMain {
|
||||
* </li>
|
||||
* </ul>
|
||||
* 除去选项之外,第一个参数会被赋值为 bot 的 telegram bot api token,
|
||||
* 第二个参数会被赋值为 bot 的 username 限定名。其余的参数会被认定为无法理解。
|
||||
* 第二个参数会被赋值为 bot 的 username 限定名。其余的参数会被认定为无法理解。<br>
|
||||
* <br>
|
||||
* <b>自 {@code 0.4.2.3},token 和 username 的赋值已被选项组支持</b><br>
|
||||
* 使用参数所进行取值的 token 和 username 已被转移至 {@code --token} 和 {@code --username} 参数,
|
||||
* <u>或许,直接参数赋值的支持将计划在 {@code 0.4.3} 标记废弃并在 {@code 0.5} 删除。</u>
|
||||
* <s>但实际上这并不影响现在的使用,选项赋值目前仍属于测试功能</s><br>
|
||||
* <b>但请勿混用</b>,这将使两个赋值出现混淆并<b>产生不可知的结果</b>
|
||||
*
|
||||
* @see MornyCoeur#main(String, String, long)
|
||||
* @since 0.4.0.0
|
||||
@ -56,11 +69,11 @@ public class ServerMain {
|
||||
String username = null;
|
||||
boolean outdatedBlock = false;
|
||||
|
||||
for (String arg : args) {
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
|
||||
if (arg.startsWith("-")) {
|
||||
if (args[i].startsWith("-")) {
|
||||
|
||||
switch (arg) {
|
||||
switch (args[i]) {
|
||||
case "--outdated-block" -> {
|
||||
outdatedBlock = true;
|
||||
continue;
|
||||
@ -77,22 +90,32 @@ public class ServerMain {
|
||||
versionEchoMode = true;
|
||||
continue;
|
||||
}
|
||||
case "--token" -> {
|
||||
i++;
|
||||
key = args[i];
|
||||
continue;
|
||||
}
|
||||
case "--username" -> {
|
||||
i++;
|
||||
username = args[i];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (key == null) {
|
||||
key = arg;
|
||||
key = args[i];
|
||||
continue;
|
||||
}
|
||||
if (username == null) {
|
||||
username = arg;
|
||||
username = args[i];
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
logger.warn("Can't understand arg to some meaning :\n " + arg);
|
||||
logger.warn("Can't understand arg to some meaning :\n " + args[i]);
|
||||
|
||||
}
|
||||
|
||||
|
@ -101,6 +101,9 @@ public class OnCallMe extends EventListener {
|
||||
* <u>known issue</u><ul>
|
||||
* <li>无法处理与转发带有媒体的消息</li>
|
||||
* </ul>
|
||||
* <br>
|
||||
* 现在你可以通过这个 bot 来呼叫主人(sukazyo)任何事情了 ——
|
||||
* <s>但是直接私聊sukazyo不好吗</s>
|
||||
*
|
||||
* @param event 执行呼叫的tg事件
|
||||
* @since 0.4.2.2
|
||||
|
Loading…
Reference in New Issue
Block a user