add bot fail exception
This commit is contained in:
parent
59a234ab71
commit
3ff1ddf972
12
cgvAjax.js
12
cgvAjax.js
|
|
@ -16,12 +16,18 @@ const bot = new TelegramBot(BOT_TOKEN, { polling: true });
|
|||
|
||||
const __INFO__ = async (str) => {
|
||||
const prefix = '[INFO]'
|
||||
await bot.sendMessage(BOT_CHATID, `${prefix} ${str}`);
|
||||
try{
|
||||
await bot.sendMessage(BOT_CHATID, `${prefix} ${str}`);
|
||||
}catch(err){
|
||||
}
|
||||
console.log(`${prefix} ${str}`);
|
||||
}
|
||||
const __ERROR__ = async (str) => {
|
||||
const prefix = '[ERROR]'
|
||||
await bot.sendMessage(BOT_CHATID, `${prefix} ${str}`);
|
||||
try{
|
||||
await bot.sendMessage(BOT_CHATID, `${prefix} ${str}`);
|
||||
}catch(err){
|
||||
}
|
||||
console.error(`${prefix} ${str}`);
|
||||
}
|
||||
|
||||
|
|
@ -501,7 +507,7 @@ await (async () => {
|
|||
|
||||
/*====== Dev Mode ======*/
|
||||
case 1:
|
||||
const result = await CGV.main_dev('20035290', null, moment('2024-03-09', 'YYYY-MM-DD')); // '20035290', null, moment('2024-03-09', 'YYYY-MM-DD' //// '20035479', null, moment('2024-02-16', 'YYYY-MM-DD'
|
||||
const result = await CGV.main_dev('20035290', null, moment('2024-03-16', 'YYYY-MM-DD')); // '20035290', null, moment('2024-03-09', 'YYYY-MM-DD' //// '20035479', null, moment('2024-02-16', 'YYYY-MM-DD'
|
||||
if (result === -1) await __ERROR__('예매에 실패했습니다!');
|
||||
else if (result === 1) await __INFO__(`예매에 성공했습니다!`);
|
||||
break
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "cgv_auto_reserve",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "app.js",
|
||||
"main": "cgvAjax.js",
|
||||
"scripts": {
|
||||
"loop": "node ./cgvAjax.js 0",
|
||||
"dev": "node ./cgvAjax.js 1",
|
||||
|
|
|
|||
Loading…
Reference in New Issue