Git Product home page Git Product logo

discord-giveaways-bot's Introduction

Giveaway Bot

🎁 Giveway Bot with slash commands made using the discord-giveaways package!

Features

  • /start-giveaway command
  • /end-giveaway command
  • /reroll-giveaway command
  • /pause-giveaway command
  • /unpause-giveaway command
  • /drop-giveaway command

Installation tutorial

  • Clone the repository (Or download it manually):
git clone https://github.com/Androz2091/giveaways-bot
  • Fill the configuration file (config.json):
{
    "token": "Your Discord bot token",
    "everyoneMention": false,
    "hostedBy": true,
    "guildId": "Your server id"
}
  • Install required dependencies (Execute below command in bot's root directory):
npm install
  • Run the bot:
node index.js

discord-giveaways-bot's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

discord-giveaways-bot's Issues

SyntaxError: The storage file is not properly formatted

Hello I'm using commando this is the error I got

0|shard    | (node:31837) UnhandledPromiseRejectionWarning: SyntaxError: The storage file is not properly formatted.
0|shard    |     at GiveawaysManager.getAllGiveaways (/root/dreambot/node_modules/discord-giveaways/src/Manager.js:272:27)
0|shard    |     at async GiveawaysManager._init (/root/dreambot/node_modules/discord-giveaways/src/Manager.js:363:26)
0|shard    | (node:31837) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
0|shard    | (node:31837) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

ReferenceError: error is not defined

i need help fixing this if you know how

(node:41652) UnhandledPromiseRejectionWarning: ReferenceError: error is not defined
at GiveawaysManager.getAllGiveaways (C:\Users\brand\Desktop\NT BOT\bot\node_modules\discord-giveaways\src\Manager.js:289:75)
at GiveawaysManager._init (C:\Users\brand\Desktop\NT BOT\bot\node_modules\discord-giveaways\src\Manager.js:391:41)
at new GiveawaysManager (C:\Users\brand\Desktop\NT BOT\bot\node_modules\discord-giveaways\src\Manager.js:57:14)
at Object. (C:\Users\brand\Desktop\NT BOT\bot\index.js:10:27)
at Module._compile (internal/modules/cjs/loader.js:1201:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
at Module.load (internal/modules/cjs/loader.js:1050:32)
at Function.Module._load (internal/modules/cjs/loader.js:938:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
(Use node --trace-warnings ... to show where the warning was created)
(node:41652) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:41652) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Hiw do i use non-unicode emojis?

I can’t use any custom emojis from my server for the giveaway. It will react but it won’t add them to the giveaway. I host this on glitch and customized it slightly.

Weird issue

When ever a giveaway ends this error keeps getting logged in console over and over again (node:10791) UnhandledPromiseRejectionWarning: Unable to fetch message with ID 715223127902126135. (node:10791) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 23)

The storage file is not properly formatted

Im getting this error (node:1688) UnhandledPromiseRejectionWarning: SyntaxError: The storage file is not properly formatted (giveaways is not an array). at GiveawaysManager.getAllGiveaways (/Users/PL/Desktop/Tyler Works-DONTrash/ducky/node_modules/discord-giveaways/src/Manager.js:300:27) at async GiveawaysManager._init (/Users/PL/Desktop/Tyler Works-DONTrash/ducky/node_modules/discord-giveaways/src/Manager.js:387:30) (node:1688) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:1688) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Time Remaining (Giveaway List)

Hi, I cant figure out how I can show the remaining time on a giveaway in the giveaway list command. Can someone help me out?

Edit: For example i made a giveaway rn with 1h duration, and i did something else and it took me 30mins, after i came back and ran the command again, the time remaining counter will be 30mins. Sorry for my bad english πŸ˜‚

Giveaway Prompt

Is there a way to make the giveaway command into a prompt?

Me: !gstart
Bot: What channel?
Me: #lounge
Bot: How many winners?
Me: 2
Bot: how long?
Me: 10m

Whoever hosts the draw is not drawn if he is the only one to participate in the draw and the draw starts with 0 winners

I am testing the project and I came across some problems, Whoever hosts the draw is not drawn if he is the only one to participate in the draw, and the draw starts with 0 winners.

If you start the draw with 0 winners at the end of the time, he does not draw anyone, the draw could not start with 0 winners and the person who creates the draw must be drawn if he is the only one to participate in the draw.

TypeError: fields.flat is not a function

I got this error when running the bot:

(node:6025) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function
    at Function.normalizeFields (/rbd/pnpm-volume/665aec89-f0d0-4faf-8158-5652ead2c334/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/structures/MessageEmbed.js:443:8)
    at MessageEmbed.setup (/rbd/pnpm-volume/665aec89-f0d0-4faf-8158-5652ead2c334/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/structures/MessageEmbed.js:77:91)
    at new MessageEmbed (/rbd/pnpm-volume/665aec89-f0d0-4faf-8158-5652ead2c334/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/structures/MessageEmbed.js:18:10)
    at embedLikes.map.e (/rbd/pnpm-volume/665aec89-f0d0-4faf-8158-5652ead2c334/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/structures/APIMessage.js:164:40)
    at Array.map (<anonymous>)
    at APIMessage.resolveData (/rbd/pnpm-volume/665aec89-f0d0-4faf-8158-5652ead2c334/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/structures/APIMessage.js:164:31)
    at TextChannel.send (/rbd/pnpm-volume/665aec89-f0d0-4faf-8158-5652ead2c334/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:166:62)
    at Promise (/rbd/pnpm-volume/665aec89-f0d0-4faf-8158-5652ead2c334/node_modules/.registry.npmjs.org/discord-giveaways/3.2.3/node_modules/discord-giveaways/src/Manager.js:179:41)
    at new Promise (<anonymous>)
    at GiveawaysManager.start (/rbd/pnpm-volume/665aec89-f0d0-4faf-8158-5652ead2c334/node_modules/.registry.npmjs.org/discord-giveaways/3.2.3/node_modules/discord-giveaways/src/Manager.js:135:16)
(node:6025) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:6025) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```

I need help

So I keep getting the error, (node:6086) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'start' of undefined
at Object.run (/root/ew/commands/owner/create.js:47:26)
at module.exports (/root/ew/events/guild/message.js:15:38)
at Client.emit (events.js:198:13)
at MessageCreateHandler.handle (/root/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/root/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (/root/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/root/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/root/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:198:13)
at Receiver.receiverOnMessage (/root/node_modules/ws/lib/websocket.js:789:20)
(node:6086) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6086) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

How can I fix this

ping

How do i disable the everyone ping?

@everyone is mentioned when giveaway starts and ends

This package is AMAZING, but I have a few suggestions you don't need to do any of this. One suggestion is to make it possible for people to add an option that displays Winner count, because right now it only says "React with πŸŽ‰to enter" and the time. I feel there should also be an option to add in "Winner count:" The second suggestion is making the @everyone message when giveaway started optional or custom! Hopefully you have read this and are willing to make some changes (keep in mind this is a simple note not mandatory)
- Thanks Again!

SyntaxError: The storage file is not properly formatted.

I have this error :

(node:16156) UnhandledPromiseRejectionWarning: SyntaxError: The storage file is not properly formatted.
at GiveawaysManager._initStorage (d:\Bureau\GiveawayBot-master\node_modules\discord-giveaways\src\Manager.js:325:27)
at async GiveawaysManager._init (d:\Bureau\GiveawayBot-master\node_modules\discord-giveaways\src\Manager.js:416:26)

Timer glitch

Hello, I was experimenting and I realised that the timer on the giveaway for me is a little bit delayed I have set it to update every 5 sec but in the beginning right after running the command it waits like 10 to 15 sec before starting. Like the timer is very slow and it is not updating every 5ms

Suggestion

Maybe have the message link of the giveaway when giveaway ends?

Giveaway Message id

Is there any way to get the msg id after the giveaway started in the command.
I mean

        // The giveaway duration
        time: ms(giveawayDuration),
        // The giveaway prize
        prize: giveawayPrize,
        // The giveaway winner count
        winnerCount: giveawayNumberWinners,
        // Who hosts this giveaway
        hostedBy: message.author,
        // Messages
        messages: {
            giveaway: "πŸŽ‰πŸŽ‰ **GIVEAWAY** πŸŽ‰πŸŽ‰",
            giveawayEnded: "πŸŽ‰πŸŽ‰ **GIVEAWAY ENDED** πŸŽ‰πŸŽ‰",
            timeRemaining: "Time remaining: **{duration}**!",
            inviteToParticipate:role?`Role requirement: ${role.join(' ')}\n`:'' + "React with πŸŽ‰ to participate!",
            winMessage: "Congratulations, {winners}! You won **{prize}**!",
            embedFooter: "Giveaways",
            noWinner: "Giveaway cancelled, no valid participations.",
            hostedBy: "Hosted by: {user}",
            winners: "winner(s)",
            endedAt: "Ended at",
            units: {
                seconds: "seconds",
                minutes: "minutes",
                hours: "hours",
                days: "days",
                pluralS: false // Not needed, because units end with a S so it will automatically removed if the unit value is lower than 2
            }
        }
    });```

After this code is there any method so that can use the msg(giveaway embed created by the manager) id in next line. 

cmd.message is not a function

Hi!
Im getting an error everytime I want to start a giveaway...

TypeError: cmd.run is not a function
    at module.exports (/home/SrDiscord/events/sorteos/message.js:19:9)
    at Client.emit (events.js:322:22)
    at MessageCreateAction.handle (/home/SrDiscord/node_modules/discord.js/src/client/actions/MessageCreate.js:31:4)

My message.js:

module.exports = (client, message) => {
    // Ignore all bots
    if (message.author.bot) return;
  
    // Ignore messages not starting with the prefix (in config.json)
    if (message.content.indexOf(client.config.prefix) !== 0) return;
  
    // Our standard argument/command name definition.
    const args = message.content.slice(client.config.prefix.length).trim().split(/ +/g);
    const command = args.shift().toLowerCase();
  
    // Grab the command data from the client.commands Enmap
    const cmd = client.commands.get(command);
  
    // If that command doesn't exist, silently exit and do nothing
    if (!cmd) return;
  
    // Run the command
    cmd.run(client, message, args);
};

Hosts

Sometimes, others want to host but they can't. So a higher person will host. But this makes that higher person not able to win. How do i make it that hosts can win?

No LICENSE

Please add a LICENSE file to your repo, so that we now what License you using. (Like MIT, GPL-2.0, ...)

I still don't see "Hosted by"

I have looked at how you have done it in the start.js file. I added that to my project, but when I start a giveaway I get this:
Screen Shot 2020-02-17 at 2 19 52 PM

The Giveaway start Freezing .

After that Update The Giveaways stop working and freeze and put this error in console Cannot find giveaway with id ... when we try to end the giveaway it do nothing. i have a bot top.gg and getting so many requests to fix this problem the whole problem is with end command

No valid participations ever

For some reason no matter who enters it will never pick a winner and it'll just say: "Giveaway cancelled, no valid participations."

Countdown not updating

Hello, for some reason the coutdown on the embed does not update it just stays at one time until the giveaway is over

Let me remove the winners thing.

image

    client.giveawaysManager.start(giveawayChannel, {
        // The giveaway duration
        time: ms(giveawayDuration),
        // The giveaway prize
        prize: giveawayPrize,
        // The giveaway winner count
        winnerCount: giveawayNumberWinners,
        // Who hosts this giveaway
        hostedBy: client.config.hostedBy ? message.author : null,
        // Messages
        messages: {
            giveaway: (client.config.everyoneMention ? "" : "")+"πŸŽ‰ **Giveaway!** πŸŽ‰",
            giveawayEnded: (client.config.everyoneMention ? "" : "")+"πŸŽ‰ **Giveaway Ended!** πŸŽ‰",
            timeRemaining: "πŸ• Time remaining: **{duration}**!",
            inviteToParticipate: "React with πŸŽ‰ to participate!",
            winMessage: "Congratulations, {winners}! You won **{prize}**!",
            embedFooter: "Giveaways",
            noWinner: "Giveaway cancelled, no valid participations.",
            hostedBy: `πŸ‘€ Hosted by: {user} \nπŸ₯‡ Winners: ${winners}`, //dont freak out, we can always go back
            winners: "", 
            endedAt: "Ended at",
            units: {
                seconds: "seconds",
                minutes: "minutes",
                hours: "hours",
                days: "days",
                pluralS: false // Not needed, because units end with a S so it will automatically removed if the unit value is lower than 2
            }
        }
    });



}

i whant to get rid of the footer of 1
Help! THANKS!

The count must be a number.

Hello, I've got an error when the giveaway is supposed to end:
(node:15844) UnhandledPromiseRejectionWarning: TypeError: The count must be a number. at Map.random (C:\Users\--\Desktop\--\node_modules\discord.js\src\util\Collection.js:134:42) at Giveaway.roll (C:\Users\--\Desktop\--\node_modules\discord-giveaways\src\Giveaway.js:304:14) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async C:\Users\--\Desktop\--\node_modules\discord-giveaways\src\Giveaway.js:354:27 (node:15844) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)

Issue With manager

when i go to use the start giveaway command i get this error [2020-03-17 02:06:54] Uncaught Promise Error: [2020-03-17 02:06:54] The manager is not ready yet.

any reason i would be getting this?

[Suggestion] Role Requirement, Guild Requirement

This feature is really cool, especially cuz a lot of people want to have a bot something like Santa Wumpus, or Prism, which both has these feature and much more. Hope you can make this true, its alright if not, its just a suggestion ❀

Suggestion

Possiblity to edit the embed. Right now it just stays as the winner count but maybe if the winner count is 1 the embed would just be Ends at (time) and if the winner count is greater than 1 then it would become (winners) winner | Ends at (time)

It's not working.

I'm using the project, people make the giveaway it works for a while and then it freezes and stops counting the time, in the file giveaway.json the giveaway information from those servers that simply froze doesn't even exist.
And when you use the index with quick.db it's the same thing

Add "Hosted by" under the timer

As a suggestion, you should be able to add a field under the timmer that says who the giveaway is hosted by. Thanks again

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.