typescript23 lines · 659 B
1import type { Mapping } from "./mapping.ts";
2import type { ScopeGuard } from "./scope.ts";
3
4export class DiscordAdapter {
5 constructor(
6 private mapping: Mapping,
7 private guard: ScopeGuard,
8 ) {}
9
10 describe(): void {
11 const m = this.mapping;
12 console.log(`axiom ${m.agent} scope=${m.scope} platform=discord`);
13 for (const ch of m.channels) {
14 console.log(` ${ch.role.padEnd(12)} ${ch.direction.padEnd(4)} ${ch.id} ${ch.name}`);
15 }
16 }
17
18 run(_collectSeconds: number): never {
19 for (const ch of this.mapping.channels) this.guard.require(ch.id, "listen");
20 throw new Error("live Discord requires DISCORD_BOT_TOKEN");
21 }
22}
23