mirror of
https://github.com/Eyre-S/Coeur-Morny-Cono.git
synced 2024-11-22 11:14:55 +08:00
@id 命令支持(相当暴力的实现),限制 @id(为了前面的功能
This commit is contained in:
parent
703ef816c6
commit
976d106de9
@ -11,6 +11,7 @@ import static cc.sukazyo.cono.morny.Logger.logger;
|
||||
public class MornyCoeur {
|
||||
|
||||
private static TelegramBot account;
|
||||
public static final String USERNAME = "morny_cono_annie_bot";
|
||||
|
||||
public static void main (String[] args) {
|
||||
|
||||
@ -20,7 +21,7 @@ public class MornyCoeur {
|
||||
logger.info("args key:\n " + args[0]);
|
||||
|
||||
try { account = login(args[0]); }
|
||||
catch (Exception e) { logger.error("Cannot login to bot/api."); System.exit(-1); }
|
||||
catch (Exception e) { logger.error("Cannot login to bot/api. :\n " + e.getMessage()); System.exit(-1); }
|
||||
|
||||
logger.info("Bot login succeed.");
|
||||
|
||||
@ -37,7 +38,10 @@ public class MornyCoeur {
|
||||
for (int i = 1; i < 4; i++) {
|
||||
if (i != 1) logger.info("retrying...");
|
||||
try {
|
||||
logger.info("Succeed login to @" + account.execute(new GetMe()).user().username());
|
||||
String username = account.execute(new GetMe()).user().username();
|
||||
if (!USERNAME.equals(username))
|
||||
throw new RuntimeException("Required the bot @"+USERNAME + " but @"+username + "logged in!");
|
||||
logger.info("Succeed login to @" + username);
|
||||
return account;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(System.out);
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cc.sukazyo.cono.morny.data;
|
||||
package cc.sukazyo.cono.morny;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class MornyHello {
|
@ -22,13 +22,17 @@ public class OnCommandExecute extends EventListener {
|
||||
}
|
||||
switch (event.message().text()) {
|
||||
case "/o":
|
||||
case "/o@" + MornyCoeur.USERNAME:
|
||||
onCommandOnExec(event);
|
||||
break;
|
||||
case "/hi":
|
||||
case "/hi@" + MornyCoeur.USERNAME:
|
||||
case "/hello":
|
||||
case "/hello@" + MornyCoeur.USERNAME:
|
||||
onCommandHelloExec(event);
|
||||
break;
|
||||
case "/exit":
|
||||
case "/exit@" + MornyCoeur.USERNAME:
|
||||
onCommandExitExec(event);
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user