@elara-services/giveaways

Welcome to the Giveaways package!

Links:

Docs Docs

Discord Support

Patreon Patreon

PayPal PayPal


Getting Started

TypeScript

    import { GiveawayClient } from "@elara-services/giveaways";
import { Client } from "discord.js";
const client = new Client({
intents: [ "Guilds" ],
});
const gw = new GiveawayClient(client, { url: "mongodb://localhost/Giveaways" });

JavaScript

    const { GiveawayClient } = require("@elara-services/giveaways");
const { Client } = require("discord.js");
const client = new Client({
intents: [ "Guilds" ],
});
const gw = new GiveawayClient(client, { url: "mongodb://localhost/Giveaways" });

Create Giveaway

    const res = await gw.api.create({
...ADD_GIVEAWAY_OPTIONS
});

Default Giveaway Handler

    await gw.handler();
// OR
await gw.handler(OPTIONAL_GIVEAWAY_FILTER);

Add User To Giveaway

    const res = await gw.users("USER_ID").add("GIVEAWAY_ID", ENTRIES_COUNT, INTERACTION_RESPONDER);

Interaction Handler

    client.on("interactionCreate", async (i) => {
if (i.isButton() || i.isModalSubmit()) { // This will handle the interactions for the buttons and everything else.
return gw.interactions.main(i, filter);
}
});

Generated using TypeDoc