23 lines
672 B
JavaScript
23 lines
672 B
JavaScript
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"]); |