1.0.2 • Published 2 years ago

giveaways.js v1.0.2

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
2 years ago

Giveaways.one | Event Handler

Installation

npm install giveaways.js --save yarn add giveaways.js

const giveaways = require("giveaways.js");

const giveawaysClient = new giveaways({
	guild: "997667712803274812", // Server ID to listen to events
	intents: [
      "BOOST",
      "UNBOOST",
      "GIVEAWAY_JOIN",
      "GIVEAWAY_FINISH",
      "GIVEAWAY_REROLL",
      "GIVEAWAY_CREATE",
	] // Join our Discord server to intents list and event names
});

giveawaysClient.on("ready", () => {
	console.log("Connected to Giftix, listening events...");
});

giveawaysClient.on("boost", ({ user }) => {
	// You can give a role to the user.
	console.log(`${user.username} boosted our server!`);
});

giveawaysClient.on("unboost", ({ user }) => {
	console.log(`${user.username} remove the boost from server. :(`);
});

giveawaysClient.on("giveawayJoin", ({ user, giveaway }) => {
	console.log(`${user.username} joined the ${giveaway.title} giveaway.`);
});

giveawaysClient.on("giveawayFinish", ({ giveaway, winners }) => {
	console.log(`${giveaway.title} has been ended. Winners: ${winners.map(_w => _w.id).join(",")}`);
});

giveawaysClient.on("giveawayReroll", ({ giveaway, winners }) => {
	console.log(`${giveaway.title} has been rerolled. New Winners: ${winners.map(_w => _w.id).join(",")}`);
});

giveawaysClient.on("giveawayDelete", ({ giveaway })  => {
	console.log(`${giveaway.title} has been deleted.`);
});
1.0.2

2 years ago

1.0.1

2 years ago