ballooninanimateinsanity

make a bot named izaac with this picture

1 image attached
Kodari AI
KodariJun 13 at 11:52 pm 7

I’ll create a Discord bot named Izaac with a clean, functional structure.

IzaacBot
A Discord bot named Izaac featuring a cute pink character avatar. Includes basic commands, event handling, and proper error management. Built with discord.py and uses environment variables for secure token storage. Features modular command structure and logging for easy debugging and maintenance.

Setup Instructions:

  1. Install Python dependencies:

    Shell
    pip install -r requirements.txt
    
  2. Create your Discord bot:

  3. Configure the bot:

    • Open .env and replace your_discord_bot_token_here with your actual token

    • In the Developer Portal, upload the pink character image as the bot’s avatar

  4. Run the bot:

    Shell
    python bot.py
    
  5. Invite to your server:

    • In Developer Portal, go to OAuth2 → URL Generator

    • Select scopes: bot, applications.commands

    • Select permissions: Send Messages, Embed Links, Read Message History

    • Copy and visit the generated URL

The bot will start with basic commands and pink-themed embeds matching the character’s aesthetic!

Kodari can make mistakes. Review important code before using.
Files
.gitignore
bot.py
README.md
requirements.txt
Code
4 124
bot.py
import discord
from discord.ext import commands
import os
from dotenv import load_dotenv
import logging

load_dotenv()

logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger('IzaacBot')

intents = discord.Intents.default()
intents.message_content = True
intents.members = True

bot = commands.Bot(command_prefix='!', intents=intents)

@bot.event
async def on_ready():
    logger.info(f'Bot is ready! Logged in as {bot.user.name} (ID: {bot.user.id})')
    logger.info(f'Connected to {len(bot.guilds)} guilds')
    await bot.change_presence(activity=discord.Game(name="!help for commands"))

@bot.event
async def on_message(message):
    if message.author.bot:
        return
    await bot.process_commands(message)

@bot.command(name='hello')
async def hello(ctx):
    """Say hello to Izaac!"""
    await ctx.send(f'Hello {ctx.author.mention}! 👋')

@bot.command(name='ping')
async def ping(ctx):
    """Check bot latency"""
    latency = round(bot.latency * 1000)
    await ctx.send(f'Pong! 🏓 Latency: {latency}ms')

@bot.command(name='info')
async def info(ctx):
    """Get information about Izaac"""
    embed = discord.Embed(
        title="About Izaac",
        description="A friendly Discord bot here to help!",
        color=discord.Color.pink()
    )
    embed.add_field(name="Servers", value=str(len(bot.guilds)), inline=True)
    embed.add_field(name="Prefix", value="!", inline=True)
    embed.set_thumbnail(url=bot.user.avatar.url if bot.user.avatar else None)
    embed.set_footer(text=f"Requested by {ctx.author.name}", icon_url=ctx.author.avatar.url if ctx.author.avatar else None)
    await ctx.send(embed=embed)

@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandNotFound):
        await ctx.send("Command not found! Use `!help` to see available commands.")
    elif isinstance(error, commands.MissingPermissions):
        await ctx.send("You don't have permission to use this command.")
    elif isinstance(error, commands.MissingRequiredArgument):
        await ctx.send(f"Missing required argument: {error.param.name}")
    else:
        logger.error(f"Error in command {ctx.command}: {error}")
        await ctx.send("An error occurred while processing the command.")

if __name__ == "__main__":
    token = os.getenv('DISCORD_TOKEN')
    if not token:
        logger.error("DISCORD_TOKEN not found in environment variables!")
        raise ValueError("DISCORD_TOKEN not found in .env file")
    bot.run(token)