# Discord Server Toolkit Bot (`hebaabdalaziz/discord-server-toolkit`) Actor

Runs a fully configurable Discord bot on your own server: welcome/leave messages, auto-moderation, an XP leveling leaderboard, custom text commands, and reaction roles.

- **URL**: https://apify.com/hebaabdalaziz/discord-server-toolkit.md
- **Developed by:** [Heba Abdalaziz](https://apify.com/hebaabdalaziz) (community)
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / actor start

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Discord Server Toolkit Bot

A fully configurable, all-in-one Discord bot you can run for your own server without writing any code.

### What it does

Toggle any combination of:

- **Welcome / leave messages** — custom greeting when members join or leave, posted in a channel you pick.
- **Auto-moderation** — automatically deletes messages containing banned words/phrases, warns the member, and (optionally) kicks or bans after repeated violations.
- **XP leveling & leaderboard** — members earn XP for chatting, level up automatically with an announcement, and can check `!rank` or `!leaderboard`.
- **Custom text commands** — define your own `!command → response` pairs.
- **Reaction roles** — the bot posts a message with emoji; members react to self-assign a role, and lose it if they remove the reaction.

### Setup

1. Go to the [Discord Developer Portal](https://discord.com/developers/applications) and create a new application.
2. Under **Bot**, click **Reset Token** to get your bot token, and enable the **Server Members Intent** and **Message Content Intent** toggles (both required for this bot to work).
3. Under **OAuth2 → URL Generator**, check the `bot` scope and these permissions: Send Messages, Manage Messages, Manage Roles, Kick Members, Ban Members, View Channels, Read Message History, Add Reactions. Open the generated URL and add the bot to your server.
4. Paste the bot token into this Actor's `botToken` input field, configure whichever features you want, and run it.

The Actor runs continuously (it's a live bot process, not a one-time scrape) — leave the run active for as long as you want the bot online. Stopping the run takes the bot offline.

### Notes

- The bot token is only ever used to connect your bot to Discord's API — it's never sent anywhere else.
- Leveling and warning data persist across restarts of the same Actor run configuration.
- Reaction-role messages are only posted once; restarting the Actor won't duplicate them.

# Actor input Schema

## `botToken` (type: `string`):

Your bot's token from the Discord Developer Portal (Applications > your app > Bot > Reset Token). This is a bot token, not your personal Discord password. Kept secret.

## `enableWelcome` (type: `boolean`):

Post a message when a member joins or leaves the server.

## `welcomeChannelName` (type: `string`):

Channel name (without #) to post welcome/leave messages in, e.g. "welcome".

## `welcomeMessage` (type: `string`):

Use {user} for a mention and {server} for the server name.

## `leaveMessage` (type: `string`):

Use {user} for the member's name.

## `enableModeration` (type: `boolean`):

Automatically delete messages containing banned words and warn/kick/ban repeat offenders.

## `bannedWords` (type: `array`):

Messages containing any of these (case-insensitive, whole word) are deleted automatically.

## `moderationAction` (type: `string`):

What happens once a member hits the warning limit below.

## `maxWarningsBeforeAction` (type: `integer`):

How many banned-word violations before the action above triggers.

## `enableLeveling` (type: `boolean`):

Members earn XP for chatting and can level up, check !rank and !leaderboard.

## `xpPerMessage` (type: `integer`):

How much XP a member earns per message (subject to a 10s cooldown per member).

## `levelUpMessage` (type: `string`):

Use {user} for a mention and {level} for the new level.

## `enableCustomCommands` (type: `boolean`):

Let the bot reply to your own custom !command triggers below.

## `commandPrefix` (type: `string`):

The character(s) that start a command, e.g. "!" for !rules.

## `customCommands` (type: `array`):

List of {"trigger": "rules", "response": "Read #rules please!"} objects. The bot replies with "response" when someone types prefix+trigger, e.g. !rules.

## `enableReactionRoles` (type: `boolean`):

Let members react to a message to self-assign a role (and remove it by un-reacting).

## `reactionRoleSetups` (type: `array`):

List of {"channelName": "roles", "introText": "React to get a role!", "roles": \[{"emoji": "🎮", "roleName": "Gamer"}]} objects. The bot posts one message per entry and assigns/removes the role when members react/unreact.

## Actor input object example

```json
{
  "enableWelcome": true,
  "welcomeChannelName": "welcome",
  "welcomeMessage": "Welcome to {server}, {user}! 🎉 Glad to have you here.",
  "leaveMessage": "{user} has left the server.",
  "enableModeration": true,
  "bannedWords": [],
  "moderationAction": "warn_only",
  "maxWarningsBeforeAction": 3,
  "enableLeveling": true,
  "xpPerMessage": 10,
  "levelUpMessage": "🎉 {user} just reached level {level}!",
  "enableCustomCommands": true,
  "commandPrefix": "!",
  "customCommands": [
    {
      "trigger": "rules",
      "response": "Please check #rules for our server guidelines!"
    }
  ],
  "enableReactionRoles": false,
  "reactionRoleSetups": []
}
```

# Actor output Schema

## `log` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("hebaabdalaziz/discord-server-toolkit").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("hebaabdalaziz/discord-server-toolkit").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call hebaabdalaziz/discord-server-toolkit --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,hebaabdalaziz/discord-server-toolkit"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/ERSXlnLCGt3avQUhv/builds/myj9dgo2dWSAwpgol/openapi.json
