parker_79411
📎 1 file 8,718 chars
📄
pasted-code-1789332924655.txt
txt 415 lines
▶
# Maple County Roleplay — Custom Staff Management Bot

I need you to create a professional, reliable, and fully functional Discord bot for **Maple County Roleplay**.

The bot's main purpose is to replace the staff-management features that ERM previously provided or that our server needs for managing staff. This should not be a basic moderation bot. It needs to be a complete staff management system designed for a serious Roblox roleplay community.

The bot should be organized, professional, easy for staff members to use, and have proper permission checks to prevent unauthorized users from using management commands.

## Main Features

### Staff Management

The bot needs a complete staff management system.

Commands and features should include:

* View a staff member's profile.
* View staff rank and position.
* View staff warnings.
* View staff strikes.
* View staff notes.
* View staff activity information.
* View join date or date added to the staff team.
* View promotion and demotion history.
* View who performed a staff action.
* Add internal notes to a staff member's profile.
* Search for a staff member.

Example command:

`/staff profile @user`

This should show an organized embed containing all available information about that staff member.

---

## Staff Warnings and Strikes

The bot needs a complete warning and strike system specifically for staff members.

Commands should include:

`/staff warn @user reason`

`/staff warnings @user`

`/staff remove-warning @user warning-id`

`/staff strike @user reason`

`/staff strikes @user`

`/staff remove-strike @user strike-id`

Every warning or strike should automatically record:

* Staff member receiving the punishment.
* Reason.
* Staff member who issued it.
* Date and time.
* Unique warning or strike ID.

The system should also keep a permanent history unless an authorized high-ranking staff member removes the record.

---

## Staff Notes

There should be an internal notes system.

Example:

`/staff note @user message`

Notes should be visible only to authorized staff members.

Commands should include:

`/staff note @user message`

`/staff notes @user`

`/staff remove-note @user note-id`

Each note should show who created it and when it was created.

---

## Promotions and Demotions

The bot needs a promotion and demotion system.

Commands:

`/staff promote @user new-rank reason`

`/staff demote @user new-rank reason`

The bot should automatically:

* Change the Discord role if configured.
* Log the action.
* Save the promotion or demotion in the user's staff history.
* Record who performed the action.
* Record the reason.
* Record the date and time.

There should also be a command to view a staff member's full rank history.

Example:

`/staff history @user`

---

## Staff Removal System

The bot should allow authorized management members to remove someone from staff.

Example:

`/staff remove @user reason`

Before permanently removing someone, the bot should ask for confirmation to prevent accidental removals.

When a staff member is removed, the bot should:

* Remove configured staff roles.
* Save the removal reason.
* Save who removed them.
* Save the date.
* Log the action.
* Keep their historical staff record.

---

## Staff Activity System

The bot should include an activity tracking system.

Features should include:

* Activity checks.
* Staff activity logging.
* Ability to manually log activity.
* Activity reports.
* Inactivity tracking.
* Ability for management to view inactive staff members.

Commands could include:

`/activity check`

`/activity log @user`

`/activity profile @user`

`/activity leaderboard`

`/activity inactive`

The activity system should be configurable because different staff ranks may have different activity requirements.

---

## Leave of Absence System

The bot needs a professional LOA system.

Staff members should be able to submit a Leave of Absence request through either a command, modal, or button.

Information collected should include:

* Discord user.
* Reason.
* Start date.
* Expected return date.

Management should be able to:

* Approve LOAs.
* Deny LOAs.
* View active LOAs.
* End an LOA early.

Commands could include:

`/loa request`

`/loa approve`

`/loa deny`

`/loa active`

`/loa end`

The bot should automatically log all LOA actions.

---

## Staff Applications

The bot should have an optional staff application system.

Users should be able to start an application through a button or command.

The application should collect customizable questions.

Applications should be sent to a private staff review channel.

Authorized staff should be able to:

* Accept applications.
* Deny applications.
* Put applications on hold.
* Leave internal notes.
* View application history.

The bot should notify the applicant of the final decision.

---

## Moderation System

While the main focus is staff management, include useful moderation commands as well.

Commands should include:

`/warn`

`/warnings`

`/kick`

`/ban`

`/unban`

`/timeout`

`/untimeout`

`/mute` if needed

`/purge`

`/slowmode`

Every moderation action should:

* Require a reason when possible.
* Be logged.
* Show who performed the action.
* Show the target user.
* Show the date and time.

---

## Staff Logging

The bot needs a complete logging system.

Different actions should be able to go to different Discord channels.

Logging categories should include:

* Staff warnings.
* Staff strikes.
* Promotions.
* Demotions.
* Staff removals.
* Staff notes.
* LOA actions.
* Application decisions.
* Moderation actions.
* Role changes.
* Bot configuration changes.

Logs should use clean and professional Discord embeds.

Each log should include:

* User affected.
* Action performed.
* Reason.
* Staff member responsible.
* Date and time.

---

## Permission System

The bot needs a secure permission system.

Do not allow every staff member to access every command.

Commands should be restricted based on Discord roles or a configurable permission system.

For example:

Lower Staff:

* Basic moderation commands.

Moderators:

* Warnings and moderation.

Administrators:

* Advanced moderation and staff notes.

Management:

* Promotions, demotions, strikes, LOAs, and staff management.

Senior Management / Ownership:

* Full access and bot configuration.

Permissions should be configurable through a setup/configuration system.

The bot should never allow a lower-ranking staff member to punish, promote, demote, or remove someone above their permission level.

---

## Setup and Configuration

The bot should include an easy configuration system.

Server ownership should be able to configure:

* Staff roles.
* Rank hierarchy.
* Logging channels.
* Application channels.
* LOA channels.
* Staff management permissions.
* Activity requirements.
* Warning and strike limits.
* Automatic punishments if needed.

Ideally, configuration should use slash commands, buttons, dropdowns, and modals instead of requiring staff members to edit code.

---

## Database

The bot MUST use a reliable database.

Do not store important staff information only temporarily in memory.

The database should permanently store:

* Staff profiles.
* Warnings.
* Strikes.
* Notes.
* Promotions.
* Demotions.
* Staff removals.
* Activity.
* LOAs.
* Applications.
* Configuration settings.
* Moderation history.

Data should remain available after the bot restarts.

---

## Command Style

Use modern Discord slash commands.

Commands should be easy to understand and organized into categories.

Examples:

`/staff`

`/activity`

`/loa`

`/moderation`

`/config`

Use autocomplete, buttons, dropdown menus, embeds, and modals wherever they improve usability.

The bot should feel like a professional management system rather than a basic Discord bot.

---

## Important Requirements

* Use Discord slash commands.
* Use professional embeds.
* Include strong permission checks.
* Prevent unauthorized access.
* Prevent lower-ranking staff from managing higher-ranking staff.
* Store data permanently in a database.
* Include confirmation buttons for serious actions such as staff removal.
* Log important actions.
* Make all major features configurable.
* Include error handling.
* Keep the code organized and easy to maintain.
* Make the bot stable enough to run continuously.
* Include instructions explaining how to install, configure, and host the bot.

The final result should be a complete **Maple County Roleplay Staff Management Bot** capable of replacing the important staff-management features that ERM provided while also giving Maple County a more customizable and professional system.

The bot should be built so additional commands and systems can easily be added in the future
Kodari AI
KodariSep 13 at 8:57 pm 2
MapleStaffManager
Complete Discord staff management bot for Maple County Roleplay. Features comprehensive staff profiles with warnings, strikes, notes, promotion/demotion history, and activity tracking. Includes LOA management system, staff applications with customizable questions, moderation commands, and configurable permission hierarchy. Uses slash commands, embeds, buttons, and modals for professional UX. Permanent SQLite database storage, role-based access control preventing lower ranks from managing higher ranks, automated logging to configurable channels, and confirmation flows for destructive actions. Fully customizable through setup commands without code editing.
  1. Create the persistent SQLite data layer and shared permission, embed, and logging services.

  2. Add staff management, activity, LOA, applications, moderation, and configuration slash-command cogs.

  3. Add the bot entry point, environment/dependency files, and installation/hosting documentation.

Created the Maple County Roleplay Staff Management Bot with:

  • Persistent SQLite database for staff profiles, warnings, strikes, notes, rank history, activity, LOAs, applications, moderation, and configuration.

  • Slash-command groups:

    • /staff

    • /activity

    • /loa

    • /applications

    • /moderation

    • /config

  • Permission hierarchy with configurable Discord roles.

  • Rank-protection checks preventing lower-ranking staff from managing higher-ranking members.

  • Confirmation buttons for staff removals.

  • Categorized embed logging.

  • Staff application modal and review workflow.

  • Professional embeds, error handling, .env configuration, and installation documentation.

  • Hosting and database backup instructions in README.md.

parker_79411

make everything you can for a roleplay server anyhting you can think of

Kodari AI
KodariSep 13 at 9:01 pm 3
  1. Audit the existing bot structure and identify the highest-value roleplay systems that are missing.

  2. Add core roleplay systems such as economy, jobs, vehicles, housing, tickets, departments, and server utilities.

  3. Connect new systems to the existing database, permissions, embeds, logging, and error handling.

  4. Update setup documentation with all new commands and configuration steps.

  1. Added roleplay character management:

    • /roleplay character-create

    • /roleplay characters

    • /roleplay profile

  2. Added licenses, vehicles, and properties:

    • /roleplay license-issue

    • /roleplay licenses

    • /roleplay vehicle-register

    • /roleplay vehicles

    • /roleplay property-add

    • /roleplay property-list

  3. Added a persistent economy system:

    • /economy balance

    • /economy pay

    • /economy history

    • /economy grant

    • /economy fine

    • Includes transaction history, balance auditing, and insufficient-funds protection.

  4. Added department shift tracking:

    • /shift start

    • /shift end

    • /shift status

    • Completed shifts automatically record activity minutes.

  5. Added dispatch functionality:

    • /dispatch post

    • Supports routine, urgent, and emergency priorities with configurable logging.

  6. Added private support tickets:

    • /ticket create

    • /ticket list

    • /ticket close

    • Creates private Discord channels with requester and support-role permissions.

  7. Expanded the permanent SQLite database with tables for:

    • Characters

    • Wallets

    • Transactions

    • Vehicles

    • Properties

    • Tickets

    • Shifts

    • Licenses

    • Dispatch messages

  8. Added new configuration options and log categories for roleplay, economy, dispatch, tickets, support roles, ticket categories, department roles, and starting balances.

  9. Fixed the existing moderation timeout bug by replacing the invalid discord.timedelta usage with Python’s datetime.timedelta.

  10. Updated the README with setup instructions and all new command groups.

Kodari can make mistakes. Review important code before using.
Files
cogs
.gitignore
bot.py
database.py
embeds.py
logging_service.py
permissions.py
README.md
requirements.txt
Code
17 1,501
bot.py
from __future__ import annotations

import logging
import os

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

from cogs.activity import Activity
from cogs.applications import Applications, ApplyView
from cogs.configuration import Configuration
from cogs.loa import LOA
from cogs.moderation import Moderation
from cogs.staff import Staff
from cogs.roleplay import Dispatch, Economy, Roleplay, Shift
from cogs.tickets import Tickets
from database import Database
from embeds import error


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


class MapleCountyBot(commands.Bot):
    def __init__(self) -> None:
        intents = discord.Intents.default()
        intents.members = True
        super().__init__(command_prefix="!", intents=intents)
        self.db = Database()

    async def setup_hook(self) -> None:
        for cog in (Staff, Activity, LOA, Applications, Moderation, Configuration, Roleplay, Economy, Shift, Dispatch, Tickets):
            await self.add_cog(cog(self))
        self.add_view(ApplyView(self.get_cog("Applications")))
        dev_guild = os.getenv("DEV_GUILD_ID")
        if dev_guild:
            guild = discord.Object(id=int(dev_guild))
            self.tree.copy_global_to(guild=guild)
            await self.tree.sync(guild=guild)
            logging.info("Slash commands synced to development guild %s", dev_guild)
        else:
            await self.tree.sync()
            logging.info("Global slash commands synced")

    async def on_ready(self) -> None:
        logging.info("Logged in as %s (%s)", self.user, self.user.id if self.user else "unknown")

    async def on_app_command_error(self, interaction: discord.Interaction, error_: app_commands.AppCommandError) -> None:
        logging.error("Slash command failed", exc_info=error_)
        message = "Something went wrong while processing that command. Check the bot logs for details."
        if isinstance(error_, app_commands.CommandOnCooldown):
            message = f"Please try again in {error_.retry_after:.1f} seconds."
        if interaction.response.is_done():
            await interaction.followup.send(embed=error(message), ephemeral=True)
        else:
            await interaction.response.send_message(embed=error(message), ephemeral=True)


bot = MapleCountyBot()
token = os.getenv("DISCORD_TOKEN")
if not token:
    raise RuntimeError("DISCORD_TOKEN is missing. Copy .env.example to .env and set it.")
bot.run(token)