Commit fbce123d authored by nanahira's avatar nanahira

detect mysql for match score

parent c2e7bd78
...@@ -323,6 +323,11 @@ init = () -> ...@@ -323,6 +323,11 @@ init = () ->
settings.modules.chat_color.enabled = false settings.modules.chat_color.enabled = false
await setting_save(settings) await setting_save(settings)
log.warn("Chat color cannot be enabled because no MySQL.") log.warn("Chat color cannot be enabled because no MySQL.")
if settings.modules.random_duel.record_match_scores
settings.modules.random_duel.record_match_scores = false
await setting_save(settings)
log.warn("Cannot record random match scores because no MySQL.")
# 读取数据 # 读取数据
default_data = await loadJSONAsync('./data/default_data.json') default_data = await loadJSONAsync('./data/default_data.json')
try try
...@@ -485,7 +490,7 @@ init = () -> ...@@ -485,7 +490,7 @@ init = () ->
if settings.modules.dialogues.get if settings.modules.dialogues.get
load_dialogues() load_dialogues()
if settings.modules.random_duel.post_match_scores if settings.modules.random_duel.post_match_scores and settings.modules.mysql.enabled
setInterval(()-> setInterval(()->
scores = await dataManager.getRandomScoreTop10() scores = await dataManager.getRandomScoreTop10()
......
...@@ -423,6 +423,11 @@ ...@@ -423,6 +423,11 @@
await setting_save(settings); await setting_save(settings);
log.warn("Chat color cannot be enabled because no MySQL."); log.warn("Chat color cannot be enabled because no MySQL.");
} }
if (settings.modules.random_duel.record_match_scores) {
settings.modules.random_duel.record_match_scores = false;
await setting_save(settings);
log.warn("Cannot record random match scores because no MySQL.");
}
} }
// 读取数据 // 读取数据
default_data = (await loadJSONAsync('./data/default_data.json')); default_data = (await loadJSONAsync('./data/default_data.json'));
...@@ -622,7 +627,7 @@ ...@@ -622,7 +627,7 @@
if (settings.modules.dialogues.get) { if (settings.modules.dialogues.get) {
load_dialogues(); load_dialogues();
} }
if (settings.modules.random_duel.post_match_scores) { if (settings.modules.random_duel.post_match_scores && settings.modules.mysql.enabled) {
setInterval(async function() { setInterval(async function() {
var scores; var scores;
scores = (await dataManager.getRandomScoreTop10()); scores = (await dataManager.getRandomScoreTop10());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment