.liamz

I want a custom bot that can do session and pager so it uses a command also can we make the pager look about like this and I’ll send message of what I want the session announcement to look like

Kodari AI
KodariNov 1 at 7:58 pm 1
SessionPagerBot
A Discord bot with two primary commands: a session command that announces scheduled game sessions with customizable announcement formatting, and a pager command that sends styled, attention-grabbing page notifications to designated channels or users. The bot uses Discord.py, supports configurable message templates, and provides role-based permissions for command usage.
  • Add a /pager command that posts an embed matching your reference, including an optional role ping.

  • Add a starter /session announcement command; I can tailor its layout once you send your example.

  • Set up the Discord bot entry point, dependencies, and token template.

Created the bot with /pager matching your reference’s red alert embed, Specialty, Room, Urgency, optional Discord-only Notes, and an optional role ping. There’s also a starter /session command; send the announcement example whenever you’re ready, and I can match its layout.

.liamz

For session command I want them to pick an option I want the option to be Sever Poll Session Start Session End

Kodari AI
KodariNov 1 at 8:03 pm 1
  1. Add a required /session type choice: Server Poll, Session Start, or Session End.

  2. Keep the announcement details and show the start-time field only when one is provided.

Added a required /session choice for Server Poll, Session Start, or Session End (corrected “Sever” to “Server”). The selected type appears in the announcement, and the start-time field is optional. Send your session announcement example when you’re ready.

.liamz

For server pool I want it to send

Kodari AI
KodariNov 1 at 8:03 pm 1

The generation was stopped before any content could be produced.

.liamz

Greetings @everyone ,

We are preparing for a potential upcoming session and are currently checking staff availability. If you’re interested in participating, please react below with your current status:

🍾 — Fully available and ready to join 🧪 — Partially available, can join later 🥂 — Unavailable at this time

Your responses will assist leadership in determining if we have sufficient staffing to proceed. A minimum of 2 available reactions is required to begin.

Host: Co-Host

Once availability is confirmed, the Server Start-Up (SSU) will begin. Thank you for your cooperation and continued dedication.

Kodari AI
KodariNov 1 at 8:04 pm 1

The generation was stopped before any content could be produced.

.liamz

Greetings @everyone ,

We are preparing for a potential upcoming session and are currently checking staff availability. If you’re interested in participating, please react below with your current status:

🍾 — Fully available and ready to join

🧪 — Partially available, can join later

🥂 — Unavailable at this time

Your responses will assist leadership in determining if we have sufficient staffing to proceed. A minimum of 2 available reactions is required to begin.

Host: Co-Host

Once availability is confirmed, the Server Start-Up (SSU) will begin. Thank you for your cooperation and continued dedication.

Kodari AI
KodariNov 1 at 8:05 pm 1
  1. Make /session post your availability-poll wording when Server Poll is selected.

  2. Add the three reaction choices automatically and allow optional Host and Co-Host names.

  3. Keep Session Start/End announcements working with title and details.

Updated /session: selecting Server Poll now posts your announcement, pings @everyone, includes optional Host and Co-Host names, and adds 🍾, 🧪, and 🥂 reactions. Session Start and Session End still require a title and details.

.liamz

Can you make it so those emojis automatically get added to the message and also you have the option to select host and co host and it @ them in the embed and that’s just for server poll and make it so it sends in the channel it’s sent in

Kodari AI
KodariNov 1 at 8:23 pm 1
  1. Make Server Poll an embed with selectable Host and Co-Host members mentioned.

  2. Keep the poll public in the command’s channel and automatically add its three reactions.

  3. Use Host and Co-Host only for Server Poll; leave other session types unchanged.

Updated /session so Server Poll posts the announcement as an embed in the channel where the command was used. Host and Co-Host are selectable member options and are mentioned in the embed; the poll still automatically adds 🍾, 🧪, and 🥂. Those options are only used for Server Poll.

.liamz

On session poll remove all the extra options like details notify role start time etc and just keep Hosta no co host

Kodari AI
KodariNov 1 at 8:28 pm 1

Plan: split /session into Server Poll, Start, and End subcommands so the poll only shows the Host option; retain announcement fields for Start/End.

Updated /session to use subcommands: /session server-poll now only has the optional Host selector—no details, notify role, start time, or Co-Host. It still posts in the command’s channel and adds the three poll reactions automatically. Session announcements remain available with /session start and /session end.

Kodari can make mistakes. Review important code before using.
Files
bot.py
requirements.txt
Code
2 201
bot.py
import logging
import os
from datetime import datetime, timezone
from typing import Optional

import discord
from discord import app_commands
from discord.ext import commands
from dotenv import load_dotenv

load_dotenv()

logging.basicConfig(
    level=logging.INFO,
    format="%(asctime)s %(levelname)s %(name)s: %(message)s",
)
logger = logging.getLogger("kodari_bot")

intents = discord.Intents.default()
bot = commands.Bot(command_prefix="!", intents=intents)


@bot.event
async def on_ready():
    try:
        synced = await bot.tree.sync()
        logger.info("Synced %s application command(s)", len(synced))
    except discord.HTTPException:
        logger.exception("Failed to sync application commands")
    logger.info("Logged in as %s", bot.user)
    print("KODARI_READY", flush=True)


@bot.tree.command(name="pager", description="Send a pager alert")
@app_commands.describe(
    specialty="The specialty or team being paged",
    room="The room or location",
    urgency="The urgency level",
    notes="Additional notes shown in Discord",
    notify_role="Role to mention with the pager alert",
)
async def pager(
    interaction: discord.Interaction,
    specialty: str,
    room: str,
    urgency: str,
    notes: Optional[str] = None,
    notify_role: Optional[discord.Role] = None,
):
    embed = discord.Embed(
        title="📟 Pager Alert",
        colour=discord.Colour.red(),
        timestamp=datetime.now(timezone.utc),
    )
    embed.add_field(name="Specialty", value=specialty, inline=True)
    embed.add_field(name="Room", value=room, inline=True)
    embed.add_field(name="Urgency", value=urgency, inline=True)
    if notes:
        embed.add_field(name="Notes (Discord only)", value=notes, inline=False)

    requester = interaction.user.display_name
    embed.set_footer(text=f"Requested by {requester}")

    content = notify_role.mention if notify_role else None
    allowed_mentions = discord.AllowedMentions(roles=[notify_role] if notify_role else [])
    await interaction.response.send_message(
        content=content,
        embed=embed,
        allowed_mentions=allowed_mentions,
    )


class SessionGroup(app_commands.Group, name="session", description="Post a session announcement"):
    @app_commands.command(name="server-poll", description="Post a staff availability poll")
    @app_commands.describe(host="Host to mention in the poll")
    async def server_poll(
        self,
        interaction: discord.Interaction,
        host: Optional[discord.Member] = None,
    ):
        poll_embed = discord.Embed(
            description=(
                "We are preparing for a potential upcoming session and are currently checking staff availability. "
                "If you’re interested in participating, please react below with your current status:\n\n"
                "🍾  — ***Fully available and ready to join***\n\n"
                "🧪   — ***Partially available, can join later***\n\n"
                "🥂  — ***Unavailable at this time***\n\n"
                "Your responses will assist leadership in determining if we have sufficient staffing to proceed. "
                "A minimum of **2 available reactions** is required to begin.\n\n"
                f"**Host:** {host.mention if host else ''}\n\n"
                "**Once availability is confirmed, the Server Start-Up (SSU) will begin. "
                "Thank you for your cooperation and continued dedication.**"
            ),
            colour=discord.Colour.blurple(),
        )
        await interaction.response.send_message(
            content="***Greetings @everyone ,***",
            embed=poll_embed,
            allowed_mentions=discord.AllowedMentions(
                everyone=True,
                users=[host] if host else [],
            ),
        )
        poll_post = await interaction.original_response()
        try:
            for emoji in ("🍾", "🧪", "🥂"):
                await poll_post.add_reaction(emoji)
        except discord.HTTPException:
            logger.exception("Posted server poll but failed to add its reactions")
            await interaction.followup.send(
                "The server poll was posted, but I couldn't add its reactions. "
                "Please check that the bot has permission to add reactions.",
                ephemeral=True,
            )

    @app_commands.command(name="start", description="Announce a session start")
    @app_commands.describe(
        title="Session announcement title",
        details="What members should know about the session",
        start_time="When the session starts, for example: Friday at 7 PM",
        notify_role="Role to mention in the announcement",
    )
    async def start(
        self,
        interaction: discord.Interaction,
        title: str,
        details: str,
        start_time: Optional[str] = None,
        notify_role: Optional[discord.Role] = None,
    ):
        await self.send_announcement(interaction, "Session Start", title, details, start_time, notify_role)

    @app_commands.command(name="end", description="Announce a session end")
    @app_commands.describe(
        title="Session announcement title",
        details="What members should know about the session",
        start_time="Optional time related to the announcement",
        notify_role="Role to mention in the announcement",
    )
    async def end(
        self,
        interaction: discord.Interaction,
        title: str,
        details: str,
        start_time: Optional[str] = None,
        notify_role: Optional[discord.Role] = None,
    ):
        await self.send_announcement(interaction, "Session End", title, details, start_time, notify_role)

    async def send_announcement(
        self,
        interaction: discord.Interaction,
        session_type: str,
        title: str,
        details: str,
        start_time: Optional[str],
        notify_role: Optional[discord.Role],
    ):
        embed = discord.Embed(
            title=title,
            description=details,
            colour=discord.Colour.blurple(),
            timestamp=datetime.now(timezone.utc),
        )
        embed.add_field(name="Type", value=session_type, inline=False)
        if start_time:
            embed.add_field(name="Starts", value=start_time, inline=False)
        embed.set_footer(text=f"Session announced by {interaction.user.display_name}")

        content = notify_role.mention if notify_role else None
        allowed_mentions = discord.AllowedMentions(roles=[notify_role] if notify_role else [])
        await interaction.response.send_message(
            content=content,
            embed=embed,
            allowed_mentions=allowed_mentions,
        )


bot.tree.add_command(SessionGroup())


@bot.tree.error
async def on_app_command_error(
    interaction: discord.Interaction,
    error: app_commands.AppCommandError,
):
    logger.error("Application command failed", exc_info=error)
    message = "Something went wrong while running that command. Please try again."
    if interaction.response.is_done():
        await interaction.followup.send(message, ephemeral=True)
    else:
        await interaction.response.send_message(message, ephemeral=True)


token = os.getenv("DISCORD_TOKEN")
if not token:
    raise RuntimeError("DISCORD_TOKEN is missing. Add it to your .env file.")

bot.run(token)