Skip to content

raphcss/CloudyAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CloudyAI Bot - Discord Moderation Bot

The CloudyAI Discord bot client handles real-time message monitoring, sanction execution, and provides an interactive setup wizard for server configuration.

🎯 Features

  • Real-Time Moderation: Monitors all messages and applies sanctions
  • Interactive Setup: DM-based configuration wizard
  • Multi-Language: Supports EN, FR, ES, DE
  • Smart Sanctions: Warn, timeout, kick, and ban capabilities
  • Staff Immunity: Moderators/admins are exempt from sanctions
  • Slash Commands: /setup and /language commands

🚀 Quick Start

Installation

cd CloudyAI
npm install

Configuration

Create .env file:

DISCORD_TOKEN=your-discord-bot-token
BOT_API_TOKEN=your-bot-api-token-here
API_BASE_URL=http://localhost:3000
API_WS_URL=http://localhost:3000

Running

node src/index.js

🎮 Discord Bot Setup

1. Create Discord Application

  1. Go to https://discord.com/developers/applications
  2. Click "New Application"
  3. Name it "CloudyAI" and create

2. Create Bot

  1. Go to "Bot" tab
  2. Click "Add Bot"
  3. Copy the token to .env as DISCORD_TOKEN

3. Enable Intents

Enable these Privileged Gateway Intents:

  • ✅ Server Members Intent
  • ✅ Message Content Intent

4. Bot Permissions

Required permissions:

  • View Channels
  • Send Messages
  • Manage Messages (delete)
  • Kick Members
  • Ban Members
  • Moderate Members (timeout)

5. Invite Bot

Use this URL (replace CLIENT_ID):

https://discord.com/oauth2/authorize?client_id=CLIENT_ID&permissions=1099780063238&scope=bot%20applications.commands

📋 Commands

/setup

Starts the interactive configuration wizard in DMs.

Permissions: Administrator or Manage Guild

Usage: /setup

/language

Changes the server's moderation language.

Permissions: Administrator or Manage Guild

Usage: /language (select from dropdown)

🔧 Setup Wizard

When a bot is added to an unconfigured server, the owner receives a DM with a setup wizard:

Step 1: Language

  • Choose: English, Français, Español, Deutsch

Step 2: Auto-Delete

  • Enable/disable automatic deletion of violating messages

Step 3: Escalation

  • Enable/disable progressive sanctions

Auto-configured settings:

  • Mode: Active (always)
  • AI Moderation: Enabled (always)

🛡️ Moderation Actions

Message Evaluation Flow

  1. Message sent in server
  2. Bot forwards to CloudyAPI for evaluation
  3. API returns decision (ALLOW, WARN, TIMEOUT, KICK, BAN)
  4. Bot executes sanction if needed

Sanction Types

WARN

  • Sends DM to user
  • No server action

TIMEOUT

  • Sends DM to user
  • Timeout for 1 minute
  • Deletes message (if auto-delete enabled)

KICK

  • Sends DM to user
  • Kicks from server
  • Deletes message

BAN

  • Sends DM to user
  • Bans from server
  • Deletes message

Staff Immunity

Users with these permissions are immune:

  • Administrator
  • Moderate Members
  • Ban Members
  • Kick Members
  • Manage Messages

Infractions are logged but no action is taken.

🌍 Localization

The bot supports 4 languages with full translations:

  • English (en)
  • French (fr)
  • Spanish (es)
  • German (de)

Language files: src/locales/*.json

📁 Project Structure

CloudyAI/
├── src/
│   ├── commands/
│   │   ├── language.js      # /language command
│   │   └── setup.js          # /setup command
│   ├── handlers/
│   │   ├── interactionHandler.js  # Slash commands & buttons
│   │   ├── messageHandler.js      # Message evaluation
│   │   └── moderationHandler.js   # Sanction execution
│   ├── utils/
│   │   ├── configSetup.js    # Setup wizard logic
│   │   └── dmHelper.js       # DM utilities
│   ├── locales/
│   │   ├── en.json           # English translations
│   │   ├── fr.json           # French translations
│   │   ├── es.json           # Spanish translations
│   │   └── de.json           # German translations
│   ├── localization.js       # Translation helper
│   └── index.js              # Main entry point
└── .env

📝 Environment Variables

Variable Description Required
DISCORD_TOKEN Discord bot token Yes
BOT_API_TOKEN CloudyAPI authentication token Yes
API_BASE_URL CloudyAPI base URL Yes
API_WS_URL CloudyAPI WebSocket URL Yes

🐛 Troubleshooting

Bot not responding

  • Check DISCORD_TOKEN is correct
  • Verify bot has required permissions
  • Check Message Content Intent is enabled

Setup DM not sent

  • Ensure bot can DM the server owner
  • Check owner's privacy settings
  • Verify guild is not configured

Sanctions not executing

  • Check bot has required permissions
  • Verify CloudyAPI is running
  • Check BOT_API_TOKEN matches API

Language not changing

  • Run /language command as admin
  • Check CloudyAPI connection
  • Verify guild configuration exists

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published