Added search song genius API
This commit is contained in:
23
index.js
Normal file
23
index.js
Normal 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"]);
|
||||
Reference in New Issue
Block a user