← Back to Home

Custom Discord Bot Documentation

Introduction

This documentation provides an overview of the custom Discord bot I developed. The bot enhances user engagement and provides utility within Discord servers by offering features such as rotating status messages, image-sharing commands, and interactive utilities.

Features

Commands and Usage

Rotating Status Messages

The bot automatically rotates its status messages every 5 seconds. The statuses include playful messages to entertain users. No user intervention is required.

Note: The status messages are customizable and can be adjusted to suit the server's audience.

Code Snippet:


@tasks.loop(seconds=5)
async def change_status():
    statuses = ["Example1", "Example2", "Example3", "Example4"]
    await bot.change_presence(activity=discord.Game(random.choice(statuses)))
    

/sb Command

Sends a random speech bubble meme from the bot's images directory.

/sb

Usage Example:

/sb

/bx Command

Shares a link to the YouTube channel "bxbrian".

/bx

/dudu Command

Shares a link to the YouTube channel "dulonkk".

/dudu

/sike Command

Sends a playful message to the user.

/sike

!info Command

Displays information about the current server.

!info

!poll Command

Creates a poll with up to two options. Users can vote by reacting with ✅ or ❌.

Usage Examples:

Code Overview

Rotating Status Messages

The bot uses a task loop to change its status every 5 seconds:


@tasks.loop(seconds=5)
async def change_status():
    statuses = ["Example1", "Example2", "Example3", "Example4"]
    await bot.change_presence(activity=discord.Game(random.choice(statuses)))
    

/sb Command Implementation

The bot sends a random speech bubble meme when the /sb command is used:


@bot.tree.command(name="sb")
async def send_image(interaction: discord.Interaction):
    image_dir = 'images'
    images = os.listdir(image_dir)
    if not images:
        await interaction.response.send_message('No images found.', ephemeral=True)
        return

    image_file = random.choice(images)
    image_path = os.path.join(image_dir, image_file)
    await interaction.response.send_message(file=discord.File(image_path))
    

!poll Command Implementation

The bot creates a poll with reactions for users to vote:


@bot.command()
async def poll(ctx, question, option1=None, option2=None):
    if option1 is None and option2 is None:
        message = await ctx.send(f"**New poll:** {question}\n✅ = Yes\n❌ = No")
    else:
        message = await ctx.send(f"**New poll:** {question}\n✅ = {option1}\n❌ = {option2}")
    await message.add_reaction('✅')
    await message.add_reaction('❌')
    

Notes

Future Enhancements

Planned features for future updates include:

← Back to Home