Commit 29861e81 authored by nanahira's avatar nanahira

arena init post

parent 9b18d639
......@@ -143,7 +143,12 @@
"ready_time": 30,
"check_permit": "https://api.mycard.moe/ygopro/match/permit",
"post_score": false,
"get_score": false
"get_score": false,
"init_post": {
"enabled": false,
"url": "https://api.mycard.moe/ygopro/match/clear",
"accesskey": "momobako"
}
},
"tournament_mode": {
"enabled": false,
......
......@@ -307,6 +307,19 @@ if settings.modules.mycard.enabled
pg_client.on 'drain', pg_client.end.bind(pg_client)
log.info "loading mycard user..."
pg_client.connect()
if settings.modules.arena_mode.enabled and settings.modules.arena_mode.init_post.enabled
request.post { url : settings.modules.arena_mode.init_post.url , qs : {
ak: settings.modules.arena_mode.init_post.accesskey,
arena: settings.modules.arena_mode.mode
}}, (error, response, body)=>
if error
log.warn 'ARENA INIT POST ERROR', error
else
if response.statusCode >= 400
log.warn 'ARENA INIT POST FAIL', response.statusCode, response.statusMessage, body
#else
# log.info 'ARENA INIT POST OK', response.statusCode, response.statusMessage
return
if settings.modules.challonge.enabled
challonge_module_name = 'challonge'
......
......@@ -356,6 +356,25 @@
pg_client.on('drain', pg_client.end.bind(pg_client));
log.info("loading mycard user...");
pg_client.connect();
if (settings.modules.arena_mode.enabled && settings.modules.arena_mode.init_post.enabled) {
request.post({
url: settings.modules.arena_mode.init_post.url,
qs: {
ak: settings.modules.arena_mode.init_post.accesskey,
arena: settings.modules.arena_mode.mode
}
}, (function(_this) {
return function(error, response, body) {
if (error) {
log.warn('ARENA INIT POST ERROR', error);
} else {
if (response.statusCode >= 400) {
log.warn('ARENA INIT POST FAIL', response.statusCode, response.statusMessage, body);
}
}
};
})(this));
}
}
if (settings.modules.challonge.enabled) {
......
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