Search code examples
pythondiscorddiscord.pypython-2.x

I'm trying to create a discord.py giveaway command


I've tried this and i didn't really get the logic through it, I need some help making it have:

  1. 🎉 Emoji
  2. Message
  3. Setting the time

My Code:

@bot.command()
async def giveaway(ctx, msg, duration):
  embed=discord.Embed()
  embed.title=msg
  embed.description="React To Giveaway With 🎉 To Join."
  embed.set_footer(text="👑 MTND Bot Development")
  embed.color=0x00ffff
  msg = await ctx.send(embed=embed)
  await msg.add_reaction('🎉')

Please help if you could.


Solution

  • In order to make an giveaway command you need first of all, on going giveaways variables:

    cmdsettings = {}
    allowedRiggers = config.riggers
    ongoingGiveaways = {}
    

    like that then embed:

        actualTitle = 'Giveaway: ' + str(msg)
        embed = discord.Embed(color=0x0040ff,title=actualTitle)
        info = "React with 🎉 on this message to enter"
        
        embed.add_field(name='Message from creator', value=message, inline=False)
        embed.add_field(name='How to enter', value=info, inline=False)
        embed.add_field(name='Giveaway end date', value=endDate, inline=False)
    

    that end date can be anything, but I am not going to show how to do it since i assume you know python. and them use those vars what i sent before, also this code is based on https://github.com/AnimeHasFallen/discordbot-giveaway/ so view the full source code there.

    • key39