mirror of
https://github.com/Eyre-S/Coeur-Morny-Cono.git
synced 2024-11-25 04:27:41 +08:00
delete deprecated -ob, add WIP --skip-login
This commit is contained in:
parent
254ec2a5a1
commit
053b789aff
@ -8,7 +8,7 @@ object MornyConfiguration {
|
||||
val MORNY_CODE_STORE = "https://github.com/Eyre-S/Coeur-Morny-Cono"
|
||||
val MORNY_COMMIT_PATH = "https://github.com/Eyre-S/Coeur-Morny-Cono/commit/%s"
|
||||
|
||||
val VERSION = "2.0.0-alpha19"
|
||||
val VERSION = "2.0.0-alpha20"
|
||||
val VERSION_DELTA: Option[String] = None
|
||||
val CODENAME = "xinzheng"
|
||||
|
||||
|
@ -416,7 +416,7 @@ class MornyCoeur (modules: List[MornyModule])(using val config: MornyConfig)(tes
|
||||
|
||||
private case class LoginResult(account: TelegramBot, username: String, userid: Long)
|
||||
|
||||
private def login (): Option[LoginResult] = {
|
||||
private def login (skip_login: Boolean = false): Option[LoginResult] = {
|
||||
|
||||
val builder = TelegramBot.Builder(config.telegramBotKey)
|
||||
var api_bot = config.telegramBotApiServer
|
||||
|
@ -61,6 +61,14 @@ public class MornyConfig {
|
||||
*/
|
||||
@Nullable public final String telegramBotUsername;
|
||||
|
||||
/**
|
||||
* 是否在启动的时候跳过登录过程。
|
||||
* <p>
|
||||
* 这将能够在没有联网的情况下也能够启动 Coeur 程序,但是可能会引发一些初始化过程中不可预知的
|
||||
* 错误。
|
||||
*/
|
||||
public final boolean telegramSkipLogin;
|
||||
|
||||
/* ======================================= *
|
||||
* morny trusted config *
|
||||
* ======================================= */
|
||||
@ -186,6 +194,7 @@ public class MornyConfig {
|
||||
this.httpPort = prototype.httpPort;
|
||||
this.debugMode = prototype.debugMode;
|
||||
this.inlineQueryCacheTimeMax = prototype.inlineQueryCacheTimeMax;
|
||||
this.telegramSkipLogin = prototype.telegramSkipLogin;
|
||||
}
|
||||
|
||||
public static class CheckFailure extends RuntimeException {
|
||||
@ -219,6 +228,7 @@ public class MornyConfig {
|
||||
public int httpPort = 30179;
|
||||
public boolean debugMode = false;
|
||||
public int inlineQueryCacheTimeMax = 300;
|
||||
public boolean telegramSkipLogin = false;
|
||||
|
||||
}
|
||||
|
||||
|
@ -47,9 +47,9 @@ object ServerMain {
|
||||
case "--version" | "-v" => mode_echoVersion = true
|
||||
|
||||
// deprecated: use --outdated-ignore instead
|
||||
case "--outdated-block" | "-ob" =>
|
||||
config.eventIgnoreOutdated = true
|
||||
deprecatedArgs += "--outdated-block" -> "--outdated-ignore"
|
||||
// case "--outdated-block" | "-ob" =>
|
||||
// config.eventIgnoreOutdated = true
|
||||
// deprecatedArgs += "--outdated-block" -> "--outdated-ignore"
|
||||
case "--outdated-ignore" | "-oig" => config.eventIgnoreOutdated = true
|
||||
|
||||
case "--api" | "-a" => i += 1; config.telegramBotApiServer = args(i)
|
||||
@ -86,6 +86,9 @@ object ServerMain {
|
||||
config.commandLoginRefresh = true
|
||||
config.commandLogoutClear = true
|
||||
|
||||
case "--skip-login" =>
|
||||
config.telegramSkipLogin = true
|
||||
|
||||
case _ => unknownArgs append args(i)
|
||||
|
||||
}
|
||||
@ -129,8 +132,8 @@ object ServerMain {
|
||||
|
|
||||
| Since 2.0.0, this mode is the combined of the two following options:
|
||||
| --debug-run enable coeur debug mode, that will disabled all the caches.
|
||||
| --verbose-logging enable the logger to output debug/trace logs."""
|
||||
.stripMargin
|
||||
| --verbose-logging enable the logger to output debug/trace logs.
|
||||
|""".stripMargin
|
||||
else if (config.debugMode)
|
||||
logger `warn`
|
||||
"""Coeur Debug mode enabled.
|
||||
@ -146,6 +149,24 @@ object ServerMain {
|
||||
| so make sure that you are not in production environment."""
|
||||
.stripMargin
|
||||
|
||||
if (config.telegramSkipLogin)
|
||||
logger `notice`
|
||||
s"""Skip Login feature enabled.
|
||||
|
|
||||
| This will skips the login process, means you can succeed start the coeur
|
||||
| even if the telegram bot key / username / userid is wrong or there's no
|
||||
| network connection at all.
|
||||
|
|
||||
| This may cause the bot runs in an unstable or even unworkable state, breaks
|
||||
| many features and even occurred bugs.
|
||||
|
|
||||
| Make sure you know what you are doing, and be well.
|
||||
|
|
||||
|""".stripMargin
|
||||
logger `warn`
|
||||
s"""The Skip Login feature is not implemented yet!
|
||||
|""".stripMargin
|
||||
|
||||
if (mode_echoVersion) {
|
||||
|
||||
logger `info`
|
||||
|
Loading…
Reference in New Issue
Block a user