UNPKG

award-api

Version:

Award | Event Handler

49 lines (40 loc) 1.34 kB
# Award | Event Handler ## Installation > npm install award-api ## Example ```js const Award = require("award-api"); const awardClient = new Award({ guild: "SERVER_ID", intents: [ "BOOST", "UNBOOST", "GIVEAWAY_JOIN", "GIVEAWAY_FINISH", "GIVEAWAY_REROLL", "GIVEAWAY_CREATE", ] // Join our Discord server to intents list and event names }); awardClient.on("ready", () => { console.log("Connected to Award"); }); awardClient.on("boost", ({ user }) => { // You can give a role to the user. console.log(`${user.username} boosted our server!`); }); awardClient.on("unboost", ({ user }) => { console.log(`${user.username} remove the boost from server. :(`); }); awardClient.on("giveawayJoin", ({ user, giveaway }) => { console.log(`${user.username} joined the ${giveaway.title} giveaway.`); }); awardClient.on("giveawayFinish", ({ giveaway, winners }) => { console.log(`${giveaway.title} has been ended. Winners: ${winners.map(_w => _w.id).join(",")}`); }); awardClient.on("giveawayReroll", ({ giveaway, winners }) => { console.log(`${giveaway.title} has been rerolled. New Winners: ${winners.map(_w => _w.id).join(",")}`); }); awardClient.on("giveawayDelete", ({ giveaway }) => { console.log(`${giveaway.title} has been deleted.`); }); ```