feat(discord): consume runtime stop approvals
Some checks failed
ci/woodpecker/pr/ci Pipeline was canceled
Some checks failed
ci/woodpecker/pr/ci Pipeline was canceled
This commit is contained in:
@@ -16,7 +16,7 @@ export interface DiscordPluginConfig {
|
||||
interactionBindings?: readonly DiscordInteractionBinding[];
|
||||
}
|
||||
|
||||
export type DiscordInteractionOperation = 'bind' | 'attach' | 'send' | 'approve';
|
||||
export type DiscordInteractionOperation = 'bind' | 'attach' | 'send' | 'approve' | 'stop';
|
||||
export type DiscordInteractionRole = 'viewer' | 'operator' | 'admin';
|
||||
|
||||
export interface DiscordInteractionBinding {
|
||||
@@ -34,6 +34,7 @@ const operationRoles: Readonly<
|
||||
attach: ['operator', 'admin'],
|
||||
send: ['operator', 'admin'],
|
||||
approve: ['admin'],
|
||||
stop: ['admin'],
|
||||
};
|
||||
|
||||
/** Resolves a configuration-owned binding and applies pairing/RBAC before ingress. */
|
||||
@@ -327,7 +328,14 @@ export class DiscordPlugin {
|
||||
},
|
||||
this.config.serviceToken,
|
||||
);
|
||||
this.socket.emit(content.startsWith('/approve ') ? 'discord:approve' : 'message', envelope);
|
||||
this.socket.emit(
|
||||
content.startsWith('/approve ')
|
||||
? 'discord:approve'
|
||||
: content.startsWith('/stop ')
|
||||
? 'discord:stop'
|
||||
: 'message',
|
||||
envelope,
|
||||
);
|
||||
}
|
||||
|
||||
private isAllowedMessage(message: DiscordMessage): boolean {
|
||||
|
||||
Reference in New Issue
Block a user