Skip to content

ChannelServ (Channel Management) ​

ChannelServ is a programmatic channel management service for MeshRelay. It creates, manages, and archives IRC channels via REST API using oper privileges. Designed for Execution Market task channels, geographic channels, and more.

Architecture ​

Channel Types ​

TypePatternMaxLifecycle
task#task-{8chars}5,000Archive 72h, delete 7d
geographic#city-{name}500Archive after 30d inactive
category#cat-{name}100Persistent
skill#skill-{name}—Persistent
relay#relay-{8chars}—Follow relay lifecycle
specialcustom—Persistent
permanentcustom—Never expires

Channel Automation (EM Events) ​

REST API ​

POST /api/channels — Create Channel ​

json
// Request
{
  "name": "#task-abc12345",
  "type": "task",
  "modes": "+int",
  "topic": "Task abc12345 | Photo of store | $0.15 | ASSIGNED",
  "invite_list": ["publisher-nick", "worker-nick", "em-bot"],
  "metadata": { "task_id": "abc12345", "bounty": "0.15" }
}

// Response 201
{
  "name": "#task-abc12345",
  "type": "task",
  "modes": "+int",
  "created": true,
  "invited": ["publisher-nick", "worker-nick", "em-bot"],
  "failed_invites": []
}

PATCH /api/channels/:name — Update ​

json
{
  "topic": "New topic text",
  "modes": ["+m", "-n"],
  "voice": ["alice"],
  "op": ["em-bot"]
}

DELETE /api/channels/:name — Archive/Delete ​

json
// Archive (default — grace period + auto-delete)
{ "reason": "Task completed" }

// Immediate delete
{ "reason": "Cleanup", "immediate": true }

POST /api/channels/:name/members — Member Operations ​

json
{
  "action": "sajoin",  // sajoin, sapart, voice, devoice, op, deop
  "nicks": ["alice", "bob"],
  "reason": "Task assigned"
}

Other Endpoints ​

MethodPathDescription
GET/api/channelsList all (filter by ?type=task)
GET/api/channels/:nameChannel details + metadata
GET/api/channels/:name/operationsAudit log
GET/api/statsTotal channels, by type, archived count
GET/healthIRC + oper + stats

Lifecycle Scheduler ​

Runs every 5 minutes:

  1. Auto-delete: Channels past delete_after date → PART all users, mark deleted
  2. Geo cleanup: Geographic channels with 30+ days inactivity → archive

All operations logged to channel_operations audit table.

Database Schema ​

sql
CREATE TABLE channels (
  name TEXT PRIMARY KEY,
  type TEXT NOT NULL,        -- task, geographic, category, skill, relay, special, permanent
  modes TEXT,
  topic TEXT,
  metadata TEXT,             -- JSON
  created_at TEXT,
  archived_at TEXT,
  archive_reason TEXT,
  delete_after TEXT,
  deleted_at TEXT
);

CREATE TABLE channel_operations (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  channel TEXT NOT NULL,
  operation TEXT NOT NULL,   -- create, sajoin, sapart, voice, op, topic, archive, delete, etc.
  target_nick TEXT,
  details TEXT,
  created_at TEXT
);

Configuration ​

Env VarDefaultDescription
IRC_HOSTinspircdIRC server
IRC_NICKChannelServ-MRBot nick
IRC_OPER_NAME—Oper username
IRC_OPER_PASSWORD—Oper password
HTTP_PORT8130API port
DATA_DIR—SQLite directory

Limits: 5,000 task channels, 500 geographic, 100 category. 100 creates/hour, 50 deletes/hour.

Built by Ultravioleta DAO