run method
Runs this command.
The return value is wrapped in a Future
if necessary and returned by
CommandRunner.runCommand
.
Implementation
@override
void run() async {
var configFile = File(argResults?['chatbot-config']);
if (!configFile.existsSync()) {
throw Exception(
'File: ${configFile.path} could not be found. This is a required file.');
}
await initializeYt();
var chatbot = Chatbot.fromYaml(configFile);
var liveBroadcastItem = await broadcast.getActiveBroadcast();
try {
await chat.answerBot(
liveBroadcastItem: liveBroadcastItem, chatbot: chatbot);
} on DioException catch (err) {
throw UsageException('API usage error:', err.usage);
}
}