K

make me a giveaway bot named penguins giveaway bot

Kodari AI
KodariJun 27 at 7:19 pm 1

🐧 Penguin’s Giveaway Bot

PenguinsGiveawayBot
A Discord giveaway bot with full lifecycle management. Create timed giveaways with configurable winners, auto-draw winners when time expires, end giveaways early, reroll winners, and list active giveaways. Entrants are tracked via reaction add/remove. All giveaways persist across bot restarts via JSON storage. Host-only and admin permissions for management commands.


6 files created. Here’s the structure:

File
Purpose
.env
Store your
DISCORD_TOKEN
here
requirements.txt
discord.py
+
python-dotenv
bot.py
Entry point β€” loads cog, runs bot with
!
prefix
giveaway_manager.py
All giveaway logic: create, enter, end, reroll, auto-check every 30s, JSON persistence
cogs/__init__.py
Package marker
cogs/giveaway.py
Discord commands + reaction listeners

Commands:

  • !gstart 1h30m 2 Nitro β€” starts a giveaway (duration, winners, prize)

  • !gend or !gend <message_id> β€” end early

  • !greroll <message_id> β€” pick new winners

  • !glist β€” show all active giveaways

  • !help β€” command overview

To run:

  1. Put your token in .env

  2. pip install -r requirements.txt

  3. python bot.py

Kodari can make mistakes. Review important code before using.
Files
__init__.py
bot.py
giveaway_manager.py
giveaway.py
requirements.txt
Code
5 383
/home/user/PenguinsGiveawayBot/bot.py
import discord
from discord.ext import commands
import os
from dotenv import load_dotenv

load_dotenv()

intents = discord.Intents.default()
intents.message_content = True
intents.reactions = True
intents.guilds = True

bot = commands.Bot(command_prefix="!", intents=intents, help_command=None)


@bot.event
async def on_ready():
    print(f"🐧 Penguin's Giveaway Bot is ready!")
    print(f"Logged in as {bot.user.name}#{bot.user.discriminator}")
    print(f"ID: {bot.user.id}")
    print("-" * 30)


@bot.command(name="help")
async def help_command(ctx):
    embed = discord.Embed(
        title="🐧 Penguin's Giveaway Bot - Help",
        description="Here are the available commands:",
        color=0x00FF00,
    )
    embed.add_field(
        name="!gstart <duration> <winners> <prize>",
        value="Start a giveaway.\nDuration: `1h30m`, `2d`, `30m`, `45s`",
        inline=False,
    )
    embed.add_field(
        name="!gend [message_id]",
        value="End a giveaway early. Leave blank to end your most recent one in this channel.",
        inline=False,
    )
    embed.add_field(
        name="!greroll <message_id>",
        value="Reroll winners for an ended giveaway.",
        inline=False,
    )
    embed.add_field(
        name="!glist",
        value="List all active giveaways in this server.",
        inline=False,
    )
    await ctx.send(embed=embed)


async def load():
    await bot.load_extension("cogs.giveaway")

if __name__ == "__main__":
    import asyncio

    asyncio.run(load())
    bot.run(os.getenv("DISCORD_TOKEN"))