mirror of
https://github.com/matrix-org/matrix-hookshot.git
synced 2025-03-10 21:19:13 +00:00

* Clippy fixes * Refactor to make rust linter happy * Enable warnings since we have none * Tidy up tests * changelog
56 lines
1.3 KiB
TypeScript
56 lines
1.3 KiB
TypeScript
import EventEmitter from "events";
|
|
import { Intent } from "matrix-bot-sdk";
|
|
import { BridgeConfig } from "./config/Config";
|
|
import { UserTokenStore } from "./UserTokenStore";
|
|
|
|
|
|
export enum Category {
|
|
ConnectionManagement = "Connection Management",
|
|
Github = "Github",
|
|
Gitlab = "Gitlab",
|
|
Jira = "Jira",
|
|
}
|
|
|
|
|
|
export interface AdminAccountData {
|
|
// eslint-disable-next-line camelcase
|
|
admin_user: string;
|
|
github?: {
|
|
notifications?: {
|
|
enabled: boolean;
|
|
participating?: boolean;
|
|
};
|
|
};
|
|
gitlab?: {
|
|
[instanceUrl: string]: {
|
|
notifications: {
|
|
enabled: boolean;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
export abstract class AdminRoomCommandHandler extends EventEmitter {
|
|
public get accountData() {
|
|
return {...this.data};
|
|
}
|
|
|
|
public get userId() {
|
|
return this.data.admin_user;
|
|
}
|
|
|
|
constructor(
|
|
protected readonly botIntent: Intent,
|
|
public readonly roomId: string,
|
|
protected tokenStore: UserTokenStore,
|
|
protected readonly config: BridgeConfig,
|
|
protected data: AdminAccountData,
|
|
) {
|
|
super();
|
|
}
|
|
public async sendNotice(noticeText: string) {
|
|
return this.botIntent.sendText(this.roomId, noticeText, "m.notice");
|
|
}
|
|
|
|
} |