How to use discord-giveaways - 7 common examples

To help you get started, we’ve selected a few discord-giveaways examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Androz2091 / AtlantaBot / events / ready.js View on Github external
/* DAILY SHOP FORTNITE */
        let fortniteShop = require("../utils/fortniteShop.js");
        fortniteShop.init(client);

        /* AUTO UPDATE DOCS */
        let autoUpdateDocs = require("../utils/autoUpdateDocs.js");
        autoUpdateDocs.update(client);

        // Start the dashboard
        if(client.config.dashboard.enabled){
            client.dashboard.load(client);
        }

        // Start update of giveaways
        let giveawaysOptions = { updateCountdownEvery: 15000, ignoreIfHasPermission: [ "ADMINISTRATOR" ], storage: require("path").resolve()+"/giveaways.json" };
        giveaways.launch(client, giveawaysOptions);

        // Update the game every 20s
        const status = require("../config.js").status,
        version = require("../package.json").version;
        let i = 0;
        setInterval(function(){
            let toDisplay = status[parseInt(i, 10)].name.replace("{serversCount}", client.guilds.size)+" | v"+version;
            client.user.setActivity(toDisplay, {type: status[parseInt(i, 10)].type});
            if(status[parseInt(i+1, 10)]) i++
            else i = 0;
        }, 20000); // Every 20 seconds

    }
}
github Androz2091 / AtlantaBot / commands / Moderation / giveaway.js View on Github external
} else if(status === "reroll"){
            let messageID = args[1];
            if(!messageID){
                return message.channel.send(message.language.get("GIVEAWAY_ERR_REROLL"));
            }
            giveaways.reroll(messageID, message.language.get("GIVEAWAY_REROLL_MESSAGES")).then(() => {
                return message.channel.send(message.language.get("GIVEAWAY_REROLLED"));
            }).catch((err) => {
                return message.channel.send(message.language.get("GIVEAWAY_ERR_REROLL_MSG_ENDED", messageID));
            });
        } else if(status === "delete"){
            let messageID = args[1];
            if(!messageID){
                return message.channel.send(message.language.get("GIVEAWAY_ERR_DELETE"));
            }
            giveaways.delete(messageID).then(() => {
                return message.channel.send(message.language.get("GIVEAWAY_DELETED"));
            }).catch((err) => {
                return message.channel.send(message.language.get("GIVEAWAY_ERR_MESSAGE_NOT_FOUND", messageID));
            });
        } else if(status === "end"){
            let messageID = args[1];
            if(!messageID){
                return message.channel.send(message.language.get("GIVEAWAY_ERR_END"));
            }
            try {
                giveaways.edit(messageID, {
                    setEndTimestamp: Date.now()
                });
                return message.channel.send(message.language.get("GIVEAWAY_ENDED"));
            } catch(e){
                return message.channel.send(message.language.get("GIVEAWAY_ERR_MESSAGE_NOT_FOUND", messageID));
github Androz2091 / AtlantaBot / commands / Moderation / giveaway.js View on Github external
let messageID = args[1];
            if(!messageID){
                return message.channel.send(message.language.get("GIVEAWAY_ERR_DELETE"));
            }
            giveaways.delete(messageID).then(() => {
                return message.channel.send(message.language.get("GIVEAWAY_DELETED"));
            }).catch((err) => {
                return message.channel.send(message.language.get("GIVEAWAY_ERR_MESSAGE_NOT_FOUND", messageID));
            });
        } else if(status === "end"){
            let messageID = args[1];
            if(!messageID){
                return message.channel.send(message.language.get("GIVEAWAY_ERR_END"));
            }
            try {
                giveaways.edit(messageID, {
                    setEndTimestamp: Date.now()
                });
                return message.channel.send(message.language.get("GIVEAWAY_ENDED"));
            } catch(e){
                return message.channel.send(message.language.get("GIVEAWAY_ERR_MESSAGE_NOT_FOUND", messageID));
            }
        } else {
            return message.channel.send(message.language.get("GIVEAWAY_ERR_STATUS"));
        }

    }
github WFCD / genesis / src / eventHandlers / Ready.js View on Github external
setupGiveaways() {
    if (!games.includes('GIVEAWAYS')) {
      this.logger.debug('No init: giveaways. Feature flag disabled.');
      return;
    }
    giveaways.launch(this.bot.client, {
      updateCountdownEvery: 5000,
      botsCanWin: false,
      ignoreIfHasPermission: [],
      embedColor: '#748BD7',
      embedColorEnd: '#FF0000',
      reaction: '🎉',
      storage: `${__dirname}/giveaways.json`,
    });
    this.logger.info('Giveaways initialized!');
  }
github Androz2091 / AtlantaBot / commands / Moderation / giveaway.js View on Github external
async run (message, args, data) {
        
        let status = args[0];
        if(!status){
            return message.channel.send(message.language.get("GIVEAWAY_ERR_STATUS"));
        }

        if(status === "create"){
            let currentGiveaways = giveaways.fetch().filter((g) => g.guildID === message.guild.id && !g.ended).length;
            if(currentGiveaways > 3){
                return message.channel.send(message.language.get("GIVEAWAY_ERR_MAX"));
            }
            let time = args[1];
            if(!time){
                return message.channel.send(message.language.get("GIVEAWAY_ERR_CREATE", data.settings.prefix));
            }
            if(isNaN(ms(time))){
                return message.channel.send(message.language.get("ERR_INVALID_TIME"));
            }
            if(ms(time) > ms("15d")){
                return message.channel.send(message.language.get("GIVEAWAY_ERR_15_DAYS"))
            }
            let winnersCount = args[2];
            if(!winnersCount){
                return message.channel.send(message.language.get("GIVEAWAY_ERR_CREATE", data.settings.prefix));
github Androz2091 / AtlantaBot / commands / Moderation / giveaway.js View on Github external
return message.channel.send(message.language.get("GIVEAWAY_ERR_CREATE", data.settings.prefix)); 
            }
            giveaways.start(message.channel, {
                time: ms(time),
                prize: prize,
                winnersCount: parseInt(winnersCount, 10),
                messages: message.language.get("GIVEAWAY_CREATE_MESSAGES")
            }).then(() => {
                message.channel.send(message.language.get("GIVEAWAY_CREATED", message.channel));
            });
        } else if(status === "reroll"){
            let messageID = args[1];
            if(!messageID){
                return message.channel.send(message.language.get("GIVEAWAY_ERR_REROLL"));
            }
            giveaways.reroll(messageID, message.language.get("GIVEAWAY_REROLL_MESSAGES")).then(() => {
                return message.channel.send(message.language.get("GIVEAWAY_REROLLED"));
            }).catch((err) => {
                return message.channel.send(message.language.get("GIVEAWAY_ERR_REROLL_MSG_ENDED", messageID));
            });
        } else if(status === "delete"){
            let messageID = args[1];
            if(!messageID){
                return message.channel.send(message.language.get("GIVEAWAY_ERR_DELETE"));
            }
            giveaways.delete(messageID).then(() => {
                return message.channel.send(message.language.get("GIVEAWAY_DELETED"));
            }).catch((err) => {
                return message.channel.send(message.language.get("GIVEAWAY_ERR_MESSAGE_NOT_FOUND", messageID));
            });
        } else if(status === "end"){
            let messageID = args[1];
github Androz2091 / AtlantaBot / commands / Moderation / giveaway.js View on Github external
}
            if(ms(time) > ms("15d")){
                return message.channel.send(message.language.get("GIVEAWAY_ERR_15_DAYS"))
            }
            let winnersCount = args[2];
            if(!winnersCount){
                return message.channel.send(message.language.get("GIVEAWAY_ERR_CREATE", data.settings.prefix));
            }
            if(isNaN(winnersCount) || winnersCount > 10 || winnersCount < 1){
                return message.channel.send(message.language.get("ERR_INVALID_NUMBER_MM", 1, 10));
            }
            let prize = args.slice(3).join(" ");
            if(!prize){
                return message.channel.send(message.language.get("GIVEAWAY_ERR_CREATE", data.settings.prefix)); 
            }
            giveaways.start(message.channel, {
                time: ms(time),
                prize: prize,
                winnersCount: parseInt(winnersCount, 10),
                messages: message.language.get("GIVEAWAY_CREATE_MESSAGES")
            }).then(() => {
                message.channel.send(message.language.get("GIVEAWAY_CREATED", message.channel));
            });
        } else if(status === "reroll"){
            let messageID = args[1];
            if(!messageID){
                return message.channel.send(message.language.get("GIVEAWAY_ERR_REROLL"));
            }
            giveaways.reroll(messageID, message.language.get("GIVEAWAY_REROLL_MESSAGES")).then(() => {
                return message.channel.send(message.language.get("GIVEAWAY_REROLLED"));
            }).catch((err) => {
                return message.channel.send(message.language.get("GIVEAWAY_ERR_REROLL_MSG_ENDED", messageID));

discord-giveaways

A complete framework to facilitate the creation of giveaways using discord.js

MIT
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis