Commit 2cb22aa3 authored by nanahira's avatar nanahira

auto respawn windbot

parent 4f8813e1
......@@ -2908,7 +2908,9 @@ if settings.modules.heartbeat_detection.enabled
, settings.modules.heartbeat_detection.interval
# spawn windbot
if settings.modules.windbot.spawn
windbot_looplimit = 0
spawn_windbot = () ->
if /^win/.test(process.platform)
windbot_bin = 'WindBot.exe'
windbot_parameters = []
......@@ -2920,9 +2922,15 @@ if settings.modules.windbot.spawn
windbot_process = spawn windbot_bin, windbot_parameters, {cwd: 'windbot'}
windbot_process.on 'error', (err)->
log.warn 'WindBot ERROR', err
if windbot_looplimit < 1000
windbot_looplimit++
spawn_windbot()
return
windbot_process.on 'exit', (code)->
log.warn 'WindBot EXIT', code
if windbot_looplimit < 1000
windbot_looplimit++
spawn_windbot()
return
windbot_process.stdout.setEncoding('utf8')
windbot_process.stdout.on 'data', (data)->
......@@ -2933,6 +2941,9 @@ if settings.modules.windbot.spawn
log.warn 'WindBot Error:', data
return
if settings.modules.windbot.enabled and settings.modules.windbot.spawn
spawn_windbot()
#http
if settings.modules.http
......
// Generated by CoffeeScript 1.12.7
(function() {
var CLIENT_get_authorize_key, CLIENT_get_kick_reconnect_target, CLIENT_heartbeat_register, CLIENT_heartbeat_unregister, CLIENT_import_data, CLIENT_is_able_to_kick_reconnect, CLIENT_is_able_to_reconnect, CLIENT_is_banned_by_mc, CLIENT_is_player, CLIENT_kick, CLIENT_kick_reconnect, CLIENT_pre_reconnect, CLIENT_reconnect, CLIENT_reconnect_register, CLIENT_reconnect_unregister, CLIENT_send_pre_reconnect_info, CLIENT_send_reconnect_info, Cloud_replay_ids, ROOM_all, ROOM_bad_ip, ROOM_ban_player, ROOM_clear_disconnect, ROOM_connected_ip, ROOM_find_by_name, ROOM_find_by_port, ROOM_find_by_title, ROOM_find_or_create_ai, ROOM_find_or_create_by_name, ROOM_find_or_create_random, ROOM_players_banned, ROOM_players_oppentlist, ROOM_unwelcome, ROOM_validate, Room, SERVER_clear_disconnect, _, addCallback, badwords, ban_user, bunyan, challonge, chat_color, config, cppversion, crypto, date, default_config, default_data, dialogues, disconnect_list, duel_log, e, exec, execFile, fs, geoip, get_memory_usage, http, http_server, https, https_server, import_datas, imported, j, l, len, len1, lflists, list, loadJSON, load_dialogues, load_tips, log, long_resolve_cards, memory_usage, merge, moment, net, oldbadwords, oldconfig, olddialogues, oldduellog, oldtips, options, os, path, pgClient, pg_client, pg_query, redis, redisdb, ref, ref1, release_disconnect, report_to_big_brother, request, requestListener, roomlist, setting_change, setting_save, settings, spawn, spawnSync, tips, url, users_cache, wait_room_start, wait_room_start_arena, windbot_bin, windbot_parameters, windbot_process, windbots, ygopro, zlib;
var CLIENT_get_authorize_key, CLIENT_get_kick_reconnect_target, CLIENT_heartbeat_register, CLIENT_heartbeat_unregister, CLIENT_import_data, CLIENT_is_able_to_kick_reconnect, CLIENT_is_able_to_reconnect, CLIENT_is_banned_by_mc, CLIENT_is_player, CLIENT_kick, CLIENT_kick_reconnect, CLIENT_pre_reconnect, CLIENT_reconnect, CLIENT_reconnect_register, CLIENT_reconnect_unregister, CLIENT_send_pre_reconnect_info, CLIENT_send_reconnect_info, Cloud_replay_ids, ROOM_all, ROOM_bad_ip, ROOM_ban_player, ROOM_clear_disconnect, ROOM_connected_ip, ROOM_find_by_name, ROOM_find_by_port, ROOM_find_by_title, ROOM_find_or_create_ai, ROOM_find_or_create_by_name, ROOM_find_or_create_random, ROOM_players_banned, ROOM_players_oppentlist, ROOM_unwelcome, ROOM_validate, Room, SERVER_clear_disconnect, _, addCallback, badwords, ban_user, bunyan, challonge, chat_color, config, cppversion, crypto, date, default_config, default_data, dialogues, disconnect_list, duel_log, e, exec, execFile, fs, geoip, get_memory_usage, http, http_server, https, https_server, import_datas, imported, j, l, len, len1, lflists, list, loadJSON, load_dialogues, load_tips, log, long_resolve_cards, memory_usage, merge, moment, net, oldbadwords, oldconfig, olddialogues, oldduellog, oldtips, options, os, path, pgClient, pg_client, pg_query, redis, redisdb, ref, ref1, release_disconnect, report_to_big_brother, request, requestListener, roomlist, setting_change, setting_save, settings, spawn, spawnSync, spawn_windbot, tips, url, users_cache, wait_room_start, wait_room_start_arena, windbot_looplimit, windbots, ygopro, zlib;
net = require('net');
......@@ -3693,7 +3693,10 @@
}, settings.modules.heartbeat_detection.interval);
}
if (settings.modules.windbot.spawn) {
windbot_looplimit = 0;
spawn_windbot = function() {
var windbot_bin, windbot_parameters, windbot_process;
if (/^win/.test(process.platform)) {
windbot_bin = 'WindBot.exe';
windbot_parameters = [];
......@@ -3708,18 +3711,30 @@
});
windbot_process.on('error', function(err) {
log.warn('WindBot ERROR', err);
if (windbot_looplimit < 1000) {
windbot_looplimit++;
spawn_windbot();
}
});
windbot_process.on('exit', function(code) {
log.warn('WindBot EXIT', code);
if (windbot_looplimit < 1000) {
windbot_looplimit++;
spawn_windbot();
}
});
windbot_process.stdout.setEncoding('utf8');
windbot_process.stdout.on('data', function(data) {
log.info('WindBot:', data);
});
windbot_process.stderr.setEncoding('utf8');
windbot_process.stderr.on('data', function(data) {
return windbot_process.stderr.on('data', function(data) {
log.warn('WindBot Error:', data);
});
};
if (settings.modules.windbot.enabled && settings.modules.windbot.spawn) {
spawn_windbot();
}
if (settings.modules.http) {
......
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