Icono de Discord Bot Gateway

Discord Bot Gateway

Sayri pluginsayri-plugin

Sayri plugins

Requires AppInstall

Security

92/100 PASSED

Classification

Sayri plugin sayri-plugin

Category

Sayri plugins

Developer

jaimegh-es

Version

1.1.0

Size

14.2 KB

You need AppInstall to download

AppInstall is the client that downloads and installs packages from this store, and verifies each package's SHA-256. Add the repository from apt.inled.es or build it from GitHub.

Sayri

README

Sayri Gateway Plugin: Discord Bot

This plugin connects any Discord server or direct message (DM) channel to your AI agents in Sayri, the personal AI assistant.


Key Features

  • Sayri xui UI (new in v1.2.0): terminal wizard (sayri-discord wizard) and local browser panel (sayri-discord serve) to configure the token, toggle guests, view and rotate pairing PIN — all decoupled from the daemon.
  • Conversation memory journal (new in v1.3.0): tasks, proposals and questions sent by authorized members are appended to per-channel Markdown files, so the server conversation survives restarts and can be reviewed later. See Conversation memory journal.
  • Flexible Invocation:
  • In server channels: /sayri <message>, !sayri <message>, or mention the bot @SayriBot <message>.
  • In DMs: Just type your question and the bot will respond.
  • Smart Channel Reading & Summarization:
  • Ask Sayri to "resume the last messages", "what was said above", or "summarize this channel" -- the gateway fetches recent messages via Discord's REST API and provides full context to the agent.
  • Secure Desktop Pairing (OTP):
  • Protection against unauthorized access with a 6-digit PIN generated on your desktop.
  • Brute-force protection with attempt limits and automatic PIN rotation.
  • Multi-Instance & Sandboxing:
  • Create multiple bot instances connected to different agents (e.g. Main Sayri, Developer Assistant) with different isolation levels (LEVEL_0_NO_EXEC to LEVEL_3_HOST_USER).
  • Zero External Dependencies:
  • Pure Python implementation with RFC 6455 WebSockets over native TLS and REST API v10.

Step-by-Step Setup Guide

Step 1: Create the Discord Application & Bot

  1. Go to the Discord Developer Portal.
  2. Click New Application in the top right and give it a name (e.g. Sayri Assistant).
  3. In the left sidebar, go to the Bot tab.
  4. Click Reset Token (or Copy), copy the Bot Token and save it (you'll need it in Sayri).

Step 2: Enable Privileged Gateway Intents (Required!)

  1. In the same Bot tab, scroll down to Privileged Gateway Intents.
  2. Enable the following:
  • MESSAGE CONTENT INTENT (Required for the bot to read /sayri <message> text in channels).
  • SERVER MEMBERS INTENT (Recommended for identifying server users).
  1. Click Save Changes at the bottom.

Step 3: Generate the Bot Invitation URL

  1. In the left sidebar, go to OAuth2 -> URL Generator.
  2. Under SCOPES, check only:
  • bot
  1. Under BOT PERMISSIONS, check:
  • Send Messages
  • Send Messages in Threads
  • Read Message History (Required for channel summarization)
  • View Channels
  • Use External Emojis (Optional)
  1. Copy the GENERATED URL at the bottom.
  2. Paste it in your browser and select the Discord server to invite the bot.

Configuration in Sayri, the personal AI assistant

  1. Open Sayri and click the Settings button.
  2. Go to the Gateways tab and click + Add Gateway.
  3. Fill in the form:
  • Platform: Select Discord Bot Gateway (sayri-gateway-discord).
  • Instance Name: e.g. Discord - Main Server.
  • Linked Agent: Select the agent (e.g. Sayri Main).
  • Sandbox Level: Select the security level (e.g. LEVEL_1_READONLY).
  • Bot Token: Paste the token you copied in Step 1.
  1. Click Create Gateway Instance. The bot will connect immediately.

Pair Your Discord Account

For security, Sayri rejects messages from unknown users until they pair with the desktop:

  1. In Sayri, on your Discord Gateway card, click Show Pairing PIN (shows a 6-digit code).
  2. In your Discord server or DM with the bot, type:
   /sayri /pair 123456

(Replace 123456 with the PIN shown on your screen.)

  1. The bot will confirm your account is authorized. You can now chat with Sayri freely!

Available Discord Commands

| Command | Description |
| :--- | :--- |
| `/sayri <question>` | Send a query or request to Sayri. |
| `!sayri <question>` | Alternative prefix to query Sayri. |
| `@SayriBot <question>` | Direct mention to the bot in any channel. |
| `/sayri resume the last messages` | Read recent channel messages and generate a structured summary. |
| `/sayri /pair <PIN>` | Pair and authorize your Discord account with Sayri. |
| `/memory [status\|on\|off\|show]` | Owner only: memory journal status, enable/disable, or show the last entries of this channel. |
| `!memory [status\|on\|off\|show]` | Text-command fallback for `/memory`. |

Conversation memory journal

While Sayri only answers when addressed, the journal is passive: it records what authorized members write — including messages that do not mention the bot — so a channel's decisions and open questions are never lost.

  • What is captured: messages classified as task, proposal or question
  • (keyword heuristics, no model call, no blocking).

  • Who is captured: the paired owner and, when guest access is enabled,
  • server members allowed to interact (/guests on). Strangers are never journaled.

  • Where: ~/.config/sayri/discord_memory/<instance>/channel_<channel_id>.md
  • (directory 0700, files 0600). The channel id is reduced to digits before becoming a filename, so a crafted identifier cannot escape the directory.

  • What it never does: reply on Discord, call Sayri Core, or modify anything
  • outside its directory — the gateway appends text and moves on.

  • Control:
  /memory            → status, directory, number of journals
  /memory show       → last 5 entries of this channel
  /memory off        → stop capturing (owner only)
  /memory on         → resume capturing
  sayri-discord memory [on|off]   # same toggle from the CLI

The journal is on by default. Captured text is stripped of control characters and truncated; the file grows append-only, so rotate or delete the directory at any time without affecting the gateway.

Description

Autonomous Discord Bot Gateway connecting server channels and DMs to Sayri AI Agents with persistent conversation memory (/new), guest access kill switch (/guests), channel summaries (/resume), and OTP desktop pairing.

Security review

92/100

✅ Approved by OpenCode AI (OpenCode Agent (opencode.ai) - Score: 92/100): No backdoors, no credential exfiltration, and no destructive commands found. The package implements strong security controls including HMAC-based PIN verification, rate limiting, PIN rotation, strict DM isolation, and a guest access kill switch. Sandbox compliance is maintained — all communication is restricted to the official Discord API and a local UNIX domain socket with no shell injection vectors.

Status
PASSED
Audited by
OpenCode Agent (opencode.ai) + VirusTotal
VirusTotal detections
0
Date
1 September 2026
Back to the store