Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var nombre = message.content.split(" ")[1];
- if (!nombre) return message.reply("Debes especificar un nombre");
- let embed = new discord.RichEmbed()
- .setColor("RANDOM")
- .setTitle("Resultados de " + nombre);
- var animes = await animeflv.searchAnime(nombre);
- if (animes.length > 1) {
- var string = "";
- for (let index = 0; index < animes.length; index++) {
- const anime = animes[index];
- string += `${animes.indexOf(anime)+1}. **${anime.label}** - **${anime.type}**\n`;
- }
- embed.setDescription(string);
- var msg = await message.channel.send(embed);
- var numero = await new Promise((resolve, reject) => {
- var collector = message.channel.createMessageCollector(m => !isNaN(m.content) && m.author.id === message.author.id && m.channel.id === message.channel.id, {time: 60000});
- collector.on("collect", m => {resolve(m); collector.stop();});
- collector.on("end", m=> resolve(null));
- });
- if (!numero) return msg.delete();
- numero = parseInt(numero) - 1;
- if (numero < 0 || numero > animes.length) numero = 0;
- var anime = animes[numero];
- } else if (animes.length == 1) var anime = animes[0]; else return message.reply("No hay resultados");
- var animeInfo = await animeflv.getAnimeInfo(anime.title, anime.animeId);
- embed.setDescription(animeInfo.description)
- .setTitle(animeInfo.label)
- .addField("Géneros:", animeInfo.genres.join("\n"), true)
- .addField("Episodios:", animeInfo.episodes.length, true)
- .addField("Puntuación:", animeInfo.rate || "Desconocido", true)
- .addField("Votos:", animeInfo.votes || "Desconocido", true)
- .setImage(anime.image)
- .setURL("https://animeflv.net" + anime.link)
- .addField("Tipo", anime.type, true);
- await message.reply(embed);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement