import 'dart:io';
void main() async {
String user = '';
var a = true;
print('Starting...');
await Delay().timer(3);
//seleção de musica
print('BOT: Selecione uma música');
try {
do {
user = stdin.readLineSync().toString();
print('Procurando...\n');
if (Musics(user).isThisMusic()) {
await Delay().timer(2);
Musics(user).musicSelection();
botTalk();
} else if (user.contains('bye')) {
await Delay().timer(1);
a = false;
} else {
await Delay().timer(3);
print('não tenho essa música em minha biblioteca :(\n'
"Digite outra música, ou fale 'bye'");
}
} while (a);
} catch (e) {
print(e);
} finally {
Delay().timer(1);
print('BOT: concluído');
}
print('desligando');
}
class Musics {
String superman = 'superman';
String mocking = 'mockingbird';
String music;
bool isThisAMusic = false;
Musics(this.music);
bool isThisMusic() {
if (music.contains('superman') || music.contains('mockingbird')) {
isThisAMusic = true;
}
return isThisAMusic;
}
musicSelection() {
if (music == superman) {
print("SUPERMAN - EMINEM\n"
"But I do know one thing though\n"
"Bitches, they come, they go\n"
"Saturday through Sunday, Monday (Yeah-yeah)\n"
"Monday through Sunday, yo\n"
"Maybe I'll love you one day\n"
"Maybe we'll someday grow\n"
"Til then just sit your drunk ass on that fuckin' runway, ho\n"
"Cause I can't be your Superman, can't be your Superman\n"
"Can't be your Superman, can't be your Superman\n"
"I can't be your Superman, can't be your Superman\n"
"Can't be your Superman, your Superman, your Superman\n");
} else if (music == mocking) {
print('MOCKINGBIRD - EMINEM\n'
"Now hush, little baby, don't you cry\n"
"Everything's gonna be alright\n"
"Stiffen that upperlip up, little lady, I told ya\n"
"Daddy's here to hold ya through the night\n"
"I know mommy's not here right now, and we don't know why\n"
"We fear how we feel inside\n"
"It may seem a little crazy, pretty baby\n"
"But I promise: Momma's gon' be alright\n");
}
}
}
class Delay {
Future timer(int timing) async {
for (int i = 0; i < timing; i++) {
await Future.delayed(Duration(seconds: 1));
}
}
}
void botTalk() {
print("BOT: fale outra música ou diga 'bye' :)");
}