Skip to content

Discord Import

sarr-io edited this page Sep 26, 2026 · 1 revision

Discord Import

A policy can opt into the built-in PA Import named discord with discord: true. This grants the agent access to scoped Discord operations through a loopback RPC service. It does not change the policy's opaque agent config. Lua loads the Import with require("discord"):

local discord = require("discord")
local messages = discord.list_messages(10)
local id = discord.create_message("hello")
return id

The Import provides context(), list_messages(limit?, before?), get_message(id), create_message(content?, filename?, bytes?, content_type?), edit_message(id, content), delete_message(id), and reactions. Lists default to 20 compact summaries (maximum 50), with at most 300 content characters per summary; use get_message(id) to retrieve a full message. create_message can attach one file using raw bytes.

The grant is channel-scoped. It permits reads in the selected channel, message creation, edits/deletes of messages created through the grant, and reactions to explicit message IDs in that channel, plus the triggering message in its original channel. Discord validates reaction targets; the grant does not authorize access to other channels. Revoking the grant prevents new calls.

The Import supplies its own document() member for agent prompt instructions. Treat access to the Import as an explicit policy capability, and review the agent code that can use it.

Clone this wiki locally