This document describes the usage and behavior of each slash command available in the bot. Commands are categorized into Admin, Default (User), and Manual Admin functionalities. These commands primarily interact with a local SQLite database, awarding or deducting points from users, and managing moderation workflows.
- π Admin Commands
- π€ Default (User) Commands
- π§ Manual Admin Commands
- π Permissions & Notes
- π Deployment Instructions
- π§ Moderator Onboarding Guide
These commands are only accessible to moderators (checked via @is_mod() decorator).
- Purpose: Deploys the interactive ticket system by placing a persistent button in the current channel.
- Behavior:
- Logs the setup initiation to the configured log channel.
- Sends a view containing the
TicketCreateButtonto the channel. - Requires appropriate channel name configuration.
- Purpose: Confirms a user's point request and awards points.
- Usage: Run this inside a thread named in the format:
someprefix_<user_id> - Arguments:
num_points(int): The number of points to award.
- Behavior:
- Extracts user ID from the thread name.
- Adds the specified points to the user's current and total in the database.
- Sends the updated point info to the user via DM.
- Deletes the thread upon successful operation.
- Purpose: Denies a point request and informs the user.
- Usage: Run this inside a thread named in the format:
someprefix_<user_id> - Arguments:
reason(str): Explanation shown to the user.
- Behavior:
- Extracts user ID from thread name.
- Sends a DM to the user with the reason.
- Logs the denial to the logs channel.
- Deletes the thread.
These are available to all users.
- Purpose: Displays the user's current and lifetime points.
- Behavior:
- Fetches user info from the local database.
- Returns the user's current and total points as an ephemeral message.
- Logs any database failure to the log channel.
- Purpose: Deducts points for a "gacha roll" that yields a prize.
- Behavior:
- Requires a minimum balance (defined in
config.GACHA_MIN_BALANCE). - Deducts points on success.
- Logs the event to the logs channel and notifies
@everyone. - Sends a placeholder message; actual prize logic can be added later.
- Requires a minimum balance (defined in
Commands for manually modifying the user database.
- Purpose: Removes a user from the database.
- Arguments:
user_id(str): The target user's Discord ID.
- Behavior:
- Tries to remove the user record.
- Logs the result.
- Returns success or failure message to the mod.
- Purpose: Adds points to a userβs current and total.
- Arguments:
key(str): Format should beuser_id:points
- Behavior:
- Adds the given points to both
points_curandpoints_total. - Logs success or failure to the logs channel.
- Adds the given points to both
- Purpose: Adds points to a user's total score only.
- Arguments:
key(str): Format should beuser_id:points
- Behavior:
- If user exists, updates their
points_totalonly. - If user doesnβt exist, inserts a new row with 0 current points.
- Logs success or failure to the logs channel.
- If user exists, updates their
- All admin and manual commands require moderator privileges via the
@is_mod()check. - Commands rely on the naming format of threads to extract user IDs (e.g.,
request_613425008575905856). - SQLite database access is done via
local_db, which must be properly initialized inmain.py. - Logs are sent to the Discord channel defined by
config.LOG_CHANNEL_NAME. - Users must have DMs open to receive confirmation/denial messages.
You can run the bot in one of the following ways:
docker pull kemsig/sasebot
docker run --env-file .env kemsig/sasebotdocker build -t sasebot .
docker run --env-file .env sasebot# (Optional) Create virtual environment
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
# Install dependencies
pip install -r requirements.txt
# Set environment variables (or use .env)
export DISCORD_BOT_SECRET=your_token
python bot.py# client secrets
DISCORD_BOT_SECRET=<your_secret>
NO_MONGO=true
LOCAL_DB_NAME=data/local.db
# Bot settings
GACHA_MIN_BALANCE=14
ADMIN_CHANNEL_NAME=sustain-admin
LOG_CHANNEL_NAME=logs-sustainability
ROLE_NAME=Sustain Mod
# other settings
# MAX_DB_SIZE=
# SETUP_MESSAGE=
# CLAIM_POINTS_MESSAGE=Welcome to the moderation team! Hereβs everything you need to know to get started using the bot effectively:
Ensure you have the role specified in .env under ROLE_NAME (e.g., Sustain Mod). This gives you access to all mod commands.
Use /setup in the appropriate channel to deploy the ticket button. This is the entry point for user point requests.
- Navigate to the thread created by a user (format:
request_<user_id>). - Run
/confirm <points>with the appropriate point amount. - The user is notified via DM and the thread is auto-deleted.
- Navigate to the thread created by a user.
- Run
/deny <reason>with a short explanation. - The user is DM'd and the thread is removed.
- Use
/addpoints user_id:amountto add points to both current and total. - Use
/addtotalpoints user_id:amountto add points only to lifetime total. - Use
/remuser user_idto completely remove a user from the database.
The bot uses a centralized logging system to report actions and errors. Logs are sent to the channel specified by LOG_CHANNEL_NAME.
- β Command Success: Logged when a command completes as expected.
β οΈ Warning: Logged for non-critical issues (e.g., user doesn't meet gacha requirements).- β Database Failure: Critical β review immediately. May indicate issues with data integrity.
- π Gacha Roll Success: Indicates a user has won a prize. Mods should follow up to deliver it.
from utils.logger import Logger
log_embed = Logger.command_success("@mod", "Successfully added 10 points to user 123456")
await logs_channel.send(embed=log_embed)If you have any issues, contact the bot maintainer or check the logs for error messages.
For any additional features, bug fixes, or to onboard new moderators, consider expanding these docs further or integrating command descriptions directly in Discord via @app_commands.describe.