Added search song genius API

This commit is contained in:
2020-12-17 22:26:43 +01:00
parent f98437335c
commit 797940993f
4 changed files with 184 additions and 0 deletions

23
index.js Normal file
View File

@@ -0,0 +1,23 @@
const Discord = require("discord.js");
const client = new Discord.Client();
const config = require("./config/config.json");
const Genius = require("./genius");
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', message => {
if (!message.content.startsWith(config.prefix) || message.author.bot) return;
const args = message.content.slice(config.prefix.length).trim().split(" ");
const command = args.shift().toLowerCase();
if (command === "add") {
Genius.search_song(args.join(" "), (song) => {
message.channel.send("Found " + song.result.full_title + ".");
})
}
})
client.login(config["discord-token"]);