Giter Club home page Giter Club logo

discord-giveaway-bot's People

Contributors

allcontributors[bot] avatar arktn avatar dependabot[bot] avatar goudronviande24 avatar jacprosser avatar oofchair avatar tanya575 avatar

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  avatar  avatar

discord-giveaway-bot's Issues

Giveaway doesn't start

I get this error on giveaway start, I ran the example command copy-pasted directly from the help message just to make sure I wasn't messing up but I get this error no matter what. I've downloaded the latest version of the bot & I've changed nothing but the prefix & token in config.json

OS: CentOS 8.3 x64
Node version: v14.16.0
Discord.js version: v12.5.3
Screen Shot 2021-05-05 at 4 10 02 PM

Sends giveaway 3 times

So, i have tried it and i set the giveaway and it does 3 giveaways instead of 1, how can this be fixed?

TypeError: Cannot read property 'start' of undefined

Hello fekt, I tried your giveaway command on my DiscordJS bot (in V12) and I have an error that I don't understand: "TypeError: Cannot read property 'start' of undefined". Thank you for answering me :)

Thanks, Spooky

weird storage error

UnhandledPromiseRejectionWarning: SyntaxError: The storage file is not properly formatted (Unexpected end of JSON input).
at GiveawaysManager.getAllGiveaways (C:\Users\yasse\Documents\YasserBot\discord-giveaway-bot-master\node_modules\discord-giveaways\src\Manager.js:338:27)
at async GiveawaysManager._init (C:\Users\yasse\Documents\YasserBot\discord-giveaway-bot-master\node_modules\discord-giveaways\src\Manager.js:447:30)
(Use node --trace-warnings ... to show where the warning was created)
(node:2028) 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:2028) [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.

The command giveaways not working

I change in my config the prefix to $ i do $help its work i do $giveaways a strange message show in the git cmd and my bot go offline and in the git cmd its tell like TypeError : message.member.hasPermission is not a function

Changing embed content

hi my friend, i am setting up a special raffle bot for myself. I want to use this infrastructure, but I have a question. After the draw is over, I don't want the name of the winner to be included in the final embed message, just displaying the winner with a plain message is sufficient. how can i remove winner name from embed message

It has erro when i end the giveaway

discord-giveaway-bot-master\node_modules\discord-giveaways\src\Giveaway.js:302
const member = guild.member(user.id) || await guild.members.fetch(user.id).catch(() => {});
^

TypeError: Cannot read properties of undefined (reading 'id')

UnhandledPromiseRejectionWarning

in the start command I get the following error: Cannot read property 'showMention' of undefined
Would you know how to solve it?
a greeting

Long giveaways would randomly break

The timer on the embed would stop. you cannnot end nor reroll the giveaway (it says giveaway not found). Sometime, the giveaway.json is cleared (just saying "[]") but usually it is still there, but the values are messed up

Contributors

This issue will be used to add contributors to the README.md trough the allcontributors.org bot.

How to make the bot 24/7

if someone ask for to bot to say online 24/7 hers sum code for it
1st step
make a new file and call it server.js
in there copy this code

const express = require('express');
const server = express();

server.all('/', (req, res)=>{
res.send('Your bot is alive!')
})
function keepAlive(){
server.listen(3000, ()=>{console.log("Server is Ready!")});
}
module.exports = keepAlive;

2nd step
in the index.js folder at the top tipe this code
const keepalive = require("./server.js")

and then go down to the botme and make a new line ontop of the token
and tipe
keepalive() then

3rd step go to https://uptimerobot.com and make a new account
after make a new moniter and make it a https

image
go back to the bot code and coppy the url and past it in the https link
image
then make the new moniter then the bot is online 24/7

Removing reactions

I tried cloning the repository for tests, configured everything, but when someone try reacting to the giveaway message the bot removes the reaction. Why is it ?

Giveaway Reroll

How I want the bot reroll Giveaway which have 2 winner and I just want to reroll just 1?

new cmds??

I really think there should be commands like reroll and end.

toLowerCase doesn't work

Here ist the "Error"

    at giveaway (C:\Users\jo_li\Documents\Altes_Zeug\Entchen\Entchen_Dev_Folder\giveaway\commands\giveaway.js:14:66)
    at Object.execute (C:\Users\jo_li\Documents\Altes_Zeug\Entchen\Entchen_Dev_Folder\giveaway\commands\giveaway.js:92:9)
    at Client.<anonymous> (C:\Users\jo_li\Documents\Altes_Zeug\Entchen\Entchen_Dev_Folder\giveaway\index.js:40:59)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (C:\Users\jo_li\Documents\Altes_Zeug\Entchen\Entchen_Dev_Folder\giveaway\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\jo_li\Documents\Altes_Zeug\Entchen\Entchen_Dev_Folder\giveaway\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\jo_li\Documents\Altes_Zeug\Entchen\Entchen_Dev_Folder\giveaway\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
    at WebSocketShard.onPacket (C:\Users\jo_li\Documents\Altes_Zeug\Entchen\Entchen_Dev_Folder\giveaway\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
    at WebSocketShard.onMessage (C:\Users\jo_li\Documents\Altes_Zeug\Entchen\Entchen_Dev_Folder\giveaway\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
    at WebSocket.onMessage (C:\Users\jo_li\Documents\Altes_Zeug\Entchen\Entchen_Dev_Folder\giveaway\node_modules\ws\lib\event-target.js:132:16)
(node:32680) 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:32680) [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 hope you can help me c:

Unnecessary extra code

For giveaway times, you could just write a ms() function instead of making statements for seconds, days, hours etc.

[Suggestion] Adding minute future into the giveaway command. + Letter feature!

My recommendation from this report is to add the following lines of code to accept minutes but hours too!

// This multiplies the input by 1 minute
const actual_duration_hours = stated_duration_hours * 60000; 

// Checks if the number given is less than a hour to set the correct statement
if (actual_duration_hours < 3600000) return hour_s = 'minutes' 
if (actual_duration_hours > 60000) return hour_s = 'minute'
if (actual_duration_hours > 3600000) return hour_s = 'hour'
if (actual_duration_hours > 7200000) return hour_s = 'hours'

Also you can add something to check if a letter is included in the message (ex. 4h or 10m)

(In case you want to use the code bellow i suggest you put it above the upper code)

// This checks if the message with the number required has a letter (h or m) to give it the appropriate multiplication. 

  if (stated_duration_hours.includes("h").toLowerCase()){
    stated_duration_hours.split("h");
    actual_duration_hours = started_duration_hours * 3600000
}

  if (stated_duration_hours.includes("m").toLowerCase()){
    stated_duration_hours.split("m");
    actual_duration_hours = started_duration_hours * 60000
}

If the code creates any errors i apologize as i don't have a way to test if it works 100% its just a suggestion

Also if you need any help with the code you can ask me!

Anyways have a nice day 🙂 !

Change word

on line 6 in end.js you need to change "reroll" to "end"

Cannot read property 'users' of undefined

In line number 69, we have the following line of code,
msg.reactions.cache.get('<a:tick:791208682607870003>').users.remove(client.user.id)
This is the error message
Cannot read property 'users' of undefined
The emojis are the only change I made in the code. Is there a bug here? How can I solve it?

It doesnt seem to work

node:internal/process/promises:246
triggerUncaughtException(err, true /* fromPromise */);
^

[UnhandledPromiseRejection: 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(). The promise rejected with the reason "options.duration is not a positive number. (val=undefined)".] {
code: 'ERR_UNHANDLED_REJECTION'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2022-02-03T00_38_15_533Z-debug.log
exit status 1

is the error i get when i run the full command

An idea

Add a local database (lodash/lowdb) and do 2 functions:

  1. Adding a prize to the base (links to a gift with nitro or a steam key).
  2. Auto-forwarding to private messages (if the participant wins, but the dm is closed, then return all the remaining "prizes" to the dm to the creator of the giveaway).
    Of course as an option.

I would be glad if you do it :D

Faulty 'if' statement

Change this line:
if (message.content.split(' ')[1] === '') return messages.channel.send('Please enter a duration for the giveaway (in hours).'); [line 10 in giveaway.js]
to this:
if (!message.content.split(' ')[1]) return messages.channel.send('Please enter a duration for the giveaway (in hours).');

In the previous case, the first if statement [if (message.content.split(' ')[1] === '')] is not considered and the if (isNaN(stated_duration_hours)) statement is run instead [line 14 in giveaway.js]

(node:3405) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'showMention' of undefined

getting the above error. here is my code-

const ms = require('ms');
const config = require("config.json")

module.exports = {
name: 'gstart',
aliases: ['giveawaystart'],
description: 'Starts a giveaway',
execute(message, args, cmd, client, Discord) {

if (!message.member.hasPermission('MANAGE_MESSAGES') && !message.member.roles.cache.some((r) => r.name === "Giveaways")) {
  return message.channel.send(':boom: You need to have the \`MANAGE_MESSAGES\` permissions to start giveaways.');
}

let giveawayChannel = message.mentions.channels.first();
if (!giveawayChannel) {
  return message.channel.send(':boom: Uh oh, I couldn\'t find that channel! Try again!');
}

let giveawayDuration = args[1];
if (!giveawayDuration || isNaN(ms(giveawayDuration))) {
  return message.channel.send(':boom: Hm. you haven\'t provided a duration. Can you try again?');
}

let giveawayNumberWinners = args[2];
if (isNaN(giveawayNumberWinners) || (parseInt(giveawayNumberWinners) <= 0)) {
  return message.channel.send(':boom: Uh... you haven\'t provided the amount of winners.');
}

let giveawayPrize = args.slice(3).join(' ');
if (!giveawayPrize) {
  return message.channel.send(':boom: Oh, it seems like you didn\'t give me a valid prize!');
}
if (!config["Giveaway_Options"].showMention && config["Giveaway_Options"].giveawayRole) {

  giveawayChannel.send(`<@&${config["Giveaway_Options"].giveawayRole}>`).then((msg) => msg.delete({ timeout: 1000 }))
  client.giveawaysManager.start(giveawayChannel, {
    time: ms(giveawayDuration),
    prize: giveawayPrize,
    winnerCount: parseInt(giveawayNumberWinners),
    hostedBy: config["Giveaway_Options"].hostedBy ? message.author : null,
    messages: {
      giveaway: ":tada: **GIVEAWAY** :tada:",
      giveawayEnded: ":tada: **GIVEAWAY ENDED** :tada:",
      timeRemaining: "Time remaining: **{duration}**!",
      inviteToParticipate: "React with 🎉 to participate!",
      winMessage: "Congratulations, {winners}! You won the **{prize}**!",
      embedFooter: "Giveaways",
      noWinner: "Not enough entrants to determine a winner!",
      hostedBy: "Hosted by: {user}",
      winners: "winner(s)",
      endedAt: "Ended at",
      units: {
        seconds: "seconds",
        minutes: "minutes",
        hours: "hours",
        days: "days",
        pluralS: false
      }
    }
  });

} else if (config["Giveaway_Options"].showMention && config["Giveaway_Options"].giveawayRole) {

  client.giveawaysManager.start(giveawayChannel, {
    time: ms(giveawayDuration),
    prize: giveawayPrize,
    winnerCount: parseInt(giveawayNumberWinners),
    hostedBy: config["Giveaway_Options"].hostedBy ? message.author : null,
    messages: {
      giveaway: (config["Giveaway_Options"].showMention ? `<@&${config["Giveaway_Options"].giveawayRole}>\n\n` : "") + ":tada: **GIVEAWAY** :tada:",
      giveawayEnded: (config["Giveaway_Options"].showMention ? `<@&${config["Giveaway_Options"].giveawayRole}>\n\n` : "") + ":tada: **GIVEAWAY ENDED** :tada:",
      timeRemaining: "Time remaining: **{duration}**!",
      inviteToParticipate: "React with 🎉 to participate!",
      winMessage: "Congratulations, {winners}! You won the **{prize}**!",
      embedFooter: "Giveaways",
      noWinner: "Not enough entrants to determine a winner!",
      hostedBy: "Hosted by: {user}",
      winners: "winner(s)",
      endedAt: "Ended at",
      units: {
        seconds: "seconds",
        minutes: "minutes",
        hours: "hours",
        days: "days",
        pluralS: false
      }
    }
  });

} else if (!config["Giveaway_Options"].showMention && !config["Giveaway_Options"].giveawayRole) {
  giveawayChannel.send(`@everyone`).then((msg) => msg.delete({ timeout: 1000 }))
  client.giveawaysManager.start(giveawayChannel, {
    time: ms(giveawayDuration),
    prize: giveawayPrize,
    winnerCount: parseInt(giveawayNumberWinners),
    hostedBy: config["Giveaway_Options"].hostedBy ? message.author : null,
    messages: {
      giveaway: ":tada: **GIVEAWAY** :tada:",
      giveawayEnded: ":tada: **GIVEAWAY ENDED** :tada:",
      timeRemaining: "Time remaining: **{duration}**!",
      inviteToParticipate: "React with 🎉 to participate!",
      winMessage: "Congratulations, {winners}! You won the **{prize}**!",
      embedFooter: "Giveaways",
      noWinner: "Not enough entrants to determine a winner!",
      hostedBy: "Hosted by: {user}",
      winners: "winner(s)",
      endedAt: "Ended at",
      units: {
        seconds: "seconds",
        minutes: "minutes",
        hours: "hours",
        days: "days",
        pluralS: false
      }
    }
  });

} else if (config["Giveaway_Options"].showMention && !config["Giveaway_Options"].giveawayRole) {
  client.giveawaysManager.start(giveawayChannel, {
    time: ms(giveawayDuration),
    prize: giveawayPrize,
    winnerCount: parseInt(giveawayNumberWinners),
    hostedBy: config["Giveaway_Options"].hostedBy ? message.author : null,
    messages: {
      giveaway: (config["Giveaway_Options"].showMention ? `@everyone\n\n` : "") + ":tada: **GIVEAWAY** :tada:",
      giveawayEnded: (config["Giveaway_Options"].showMention ? `@everyone\n\n` : "") + ":tada: **GIVEAWAY ENDED** :tada:",
      timeRemaining: "Time remaining: **{duration}**!",
      inviteToParticipate: "React with 🎉 to participate!",
      winMessage: "Congratulations, {winners}! You won the **{prize}**!",
      embedFooter: "Giveaways",
      noWinner: "Not enough entrants to determine a winner!",
      hostedBy: "Hosted by: {user}",
      winners: "winner(s)",
      endedAt: "Ended at",
      units: {
        seconds: "seconds",
        minutes: "minutes",
        hours: "hours",
        days: "days",
        pluralS: false
      }
    }
  });
}


message.channel.send(`:tada: Done! The giveaway for the \`${giveawayPrize}\` is starting in ${giveawayChannel}!`);

}
}

suggestion

Hello to the creator of this project, our suggestion for this has been to add the proposed code to the project which means by preparing command on the channel you like

Running my bot not working

When i edit my config file and everything done i run the code by the start-me file thing but when i check the bot its still on invisible

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.