print
Some checks are pending
Deploy Telegram Bot / Deploy Telegram Bot (push) Waiting to run

This commit is contained in:
Dmitry 2025-12-11 21:16:10 +03:00
parent f056961d8e
commit 090abb06f2

View file

@ -1,4 +1,3 @@
import 'dart:developer';
import 'dart:io';
import 'package:path/path.dart';
import 'package:mnemo_cards_telegram_bot/bot_config.dart';
@ -93,7 +92,7 @@ Future<void> _handleCodeClaim({
}
Future<void> _run() async {
log('Starting bot version $version');
print('[BOT] Starting bot version $version');
BackendClient? backendClient;
TeleDart? teledart;
@ -104,7 +103,7 @@ Future<void> _run() async {
final adminIds = lines.map((e) => e.trim()).toList();
if (adminIds.isEmpty) {
log('No admins found in admins file');
print('[BOT] ERROR: No admins found in admins file');
return;
}
@ -116,12 +115,12 @@ Future<void> _run() async {
try {
await teledart!.sendMessage(admin, message);
} catch (e) {
log('Failed to notify admin $admin', error: e);
print('[BOT] ERROR: Failed to notify admin $admin: $e');
}
}
}
log('Using backend API at ${config.backendUrl}');
print('[BOT] Using backend API at ${config.backendUrl}');
backendClient = BackendClient(
backendUrl: config.backendUrl,
@ -259,7 +258,7 @@ Future<void> _run() async {
} else {
message.reply('Что-то пошло не так');
}
log('app error', error: e, stackTrace: s);
print('[BOT] ERROR: app error: $e\n$s');
}
});
@ -294,7 +293,7 @@ Future<void> _run() async {
teledartInstance.sendMessage(message.chat.id, 'Загрузка apk...');
message.replyDocument(file, caption: t.simpleString);
} on Object catch (e, s) {
log('app error', error: e, stackTrace: s);
print('[BOT] ERROR: app error: $e\n$s');
message.reply(e.toString());
}
}
@ -314,7 +313,7 @@ Future<void> _run() async {
answer.write('$type/$size - ok\n');
} catch (e, s) {
answer.write('$type/$size - error\n');
log('clear cache error $dir', error: e, stackTrace: s);
print('[BOT] ERROR: clear cache error $dir: $e\n$s');
}
} else {
answer.write('$type/$size - not exists\n');
@ -359,7 +358,7 @@ Future<void> _run() async {
);
}
} on Object catch (e, s) {
log('app error', error: e, stackTrace: s);
print('[BOT] ERROR: app error: $e\n$s');
message.reply(e.toString());
}
}
@ -392,7 +391,7 @@ Future<void> _run() async {
);
}
} on Object catch (e, s) {
log('app error', error: e, stackTrace: s);
print('[BOT] ERROR: app error: $e\n$s');
message.reply(e.toString());
}
}
@ -437,7 +436,7 @@ Future<void> _run() async {
message.reply('No backups');
}
} on Object catch (e, s) {
log('backup error', error: e, stackTrace: s);
print('[BOT] ERROR: backup error: $e\n$s');
message.reply(e.toString());
}
}
@ -587,10 +586,10 @@ Future<void> _run() async {
});
teledartInstance.start();
log('Bot started');
print('[BOT] Bot started successfully');
} on Exception catch (e, s) {
log('Error: $e', error: e, stackTrace: s);
print('Error while starting bot: $e');
print('[BOT] ERROR: Error: $e\n$s');
print('[BOT] Error while starting bot: $e');
print('Stack trace: $s');
print('');
print('Required environment variables:');