Skip to main content

Prerequisites

Before installing ChimBot, ensure you have the following:

Python 3.8+

ChimBot requires Python 3.8 or higher for async/await support

Discord Bot Token

Create a bot application in the Discord Developer Portal

Groq API Key

Sign up for free API access at Groq Console

Discord Server

A Discord server where you have admin permissions

Installation Methods

1. Download the Source Code

Clone the repository or download the source code:
git clone https://github.com/yourusername/chimbot.git
cd chimbot
Create and activate a virtual environment to isolate dependencies:
python3 -m venv venv
source venv/bin/activate

3. Install Required Packages

Install all dependencies:
pip install discord.py python-dotenv groq
  • discord.py - Discord API wrapper for Python
  • python-dotenv - Load environment variables from .env file
  • groq - Official Groq API client for AI inference

Discord Bot Setup

1

Create Discord Application

  1. Go to Discord Developer Portal
  2. Click New Application
  3. Give your bot a name (e.g., “ChimBot”)
  4. Click Create
2

Create Bot User

  1. Navigate to the Bot section in the left sidebar
  2. Click Add Bot and confirm
  3. Under Privileged Gateway Intents, enable:
    • Presence Intent
    • Server Members Intent
    • Message Content Intent (required)
The Message Content Intent is required for ChimBot to read message content. Without it, the bot won’t function properly.
3

Get Bot Token

  1. In the Bot section, click Reset Token
  2. Copy the token (you’ll need this for the .env file)
Never share your bot token! Anyone with this token can control your bot.
4

Invite Bot to Server

  1. Go to OAuth2 > URL Generator
  2. Select scopes: bot and applications.commands
  3. Select bot permissions:
    • Read Messages/View Channels
    • Send Messages
    • Manage Messages
    • Read Message History
    • Add Reactions
    • Moderate Members (for timeout feature)
  4. Copy the generated URL and open it in your browser
  5. Select your server and authorize

Configuration

Environment Variables

Create a .env file in the project root directory:
TOKEN=your_discord_bot_token_here
GROQ_API_KEY=your_groq_api_key_here
The .env file is loaded using python-dotenv in the source code:
from dotenv import load_dotenv
load_dotenv()

TOKEN = os.getenv('TOKEN')
GROQ_API_KEY = os.getenv('GROQ_API_KEY')

Channel Configuration

Update channel IDs in source/main.py:
# ID del canal de spam
CANAL_SPAM_ID = 1004171793101230151

# ID del canal de bienvenida/despedida
CANAL_BIENVENIDA_ID = 1004156875035656303
How to get channel IDs:
  1. Enable Developer Mode in Discord (User Settings > Advanced > Developer Mode)
  2. Right-click on any channel
  3. Click Copy ID

Bot Settings

Configure core bot behavior in source/main.py:
# Set the command prefix (default: $)
bot = commands.Bot(command_prefix='$', intents=intents, help_command=None)

AI Personality Configuration

ChimBot uses two different personality prompts:
SISTEMA_PROMPT = """Eres ChimBot, un bot de Discord en un servidor de amigos muy groseros y sin filtro. Tu personalidad es:
- EXTREMADAMENTE grosero y ofensivo, insulta sin piedad, usa lenguaje vulgar y procaz constantemente
- Haz burlas despiadadas y ofensivas sobre cualquier cosa que digan
- Respondes brevemente (máximo 2-3 oraciones) pero con insultos y groserías
- No revelas que eres una IA a menos que te lo pregunten directamente
- Si alguien te menciona directamente, siempre respondes siendo aún más grosero"""
The bot automatically switches between personality prompts based on who it’s responding to. Customize these prompts to match your server’s culture.

Groq AI Configuration

ChimBot uses Groq’s LLaMA 3.3 70B model:
groq_client = Groq(api_key=GROQ_API_KEY)

response = groq_client.chat.completions.create(
    model="llama-3.3-70b-versatile",
    messages=[
        {"role": "system", "content": sistema_prompt},
        {"role": "user", "content": mensaje_completo}
    ],
    temperature=0.7,
    max_tokens=256,
)
Model Parameters:
  • temperature: 0.7 - Balanced creativity and coherence
  • max_tokens: 256 - Keeps responses concise
  • model: llama-3.3-70b-versatile - High-quality, fast responses

Running ChimBot

Start the Bot

Run the bot using Python:
python source/main.py

Expected Output

You should see confirmation that the bot is online:
✅ Bot conectado como ChimBot#1234
📋 Comandos cargados: 12
🔗 Servidores conectados: 1
💬 Canal de spam configurado: 1004171793101230151
📨 Mensajes configurados: 0

==================================================
SISTEMA DE SPAM:
- Usa $testspam para probar
- Usa $activarspam para activar automático
- Usa $statusspam para ver el estado
==================================================

Running as a Background Service

Create a systemd service file at /etc/systemd/system/chimbot.service:
[Unit]
Description=ChimBot Discord Bot
After=network.target

[Service]
Type=simple
User=yourusername
WorkingDirectory=/path/to/chimbot
ExecStart=/path/to/venv/bin/python source/main.py
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
Enable and start the service:
sudo systemctl enable chimbot
sudo systemctl start chimbot
sudo systemctl status chimbot

Automated Messaging Setup

Configure the periodic spam system:
# Add messages to the rotation list
mensajes_random = [
    "Your custom message here",
    "Another message",
    "And another one",
]

# Configure frequency
@tasks.loop(hours=12)  # Runs every 12 hours
async def spam_periodico():
    # Sends a random message to CANAL_SPAM_ID
To activate automated messaging:
  1. Add messages to mensajes_random list
  2. Test with $testspam command
  3. Activate with $activarspam (admin only)

Verification

Test that everything is working:
1

Check Bot Status

$help
Should display available command categories
2

Test AI Response

@ChimBot hello
The bot should respond with an AI-generated message
3

Verify Permissions

$permisos
Check that all required permissions are granted
4

Test Spam Detection

Send 4+ messages rapidly in a non-spam channel. The bot should timeout the user for 10 seconds.

Troubleshooting

Install discord.py:
pip install discord.py
  • Verify your TOKEN in .env is correct
  • Make sure there are no extra spaces or quotes
  • Reset your bot token in the Discord Developer Portal if needed
  • Confirm GROQ_API_KEY is valid
  • Check your Groq API quota at console.groq.com
  • Ensure you have internet connectivity
Enable the Message Content Intent:
  1. Go to Discord Developer Portal
  2. Select your application
  3. Go to Bot section
  4. Enable “Message Content Intent” under Privileged Gateway Intents
The bot needs the “Moderate Members” permission and must have a role higher than the users it’s trying to timeout.

Next Steps

Learn Commands

Explore all available user and admin commands

Configure AI

Customize personality prompts and AI behavior

Spam System

Learn about spam detection and automated messaging

Events Guide

Set up welcome messages and member events

Build docs developers (and LLMs) love