This repository has been archived by the owner on Apr 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CoinFlipApp.ts
43 lines (36 loc) · 1.59 KB
/
CoinFlipApp.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import {
IConfigurationExtend, IEnvironmentRead, ILogger,
} from '@rocket.chat/apps-engine/definition/accessors';
import { App } from '@rocket.chat/apps-engine/definition/App';
import { IAppInfo } from '@rocket.chat/apps-engine/definition/metadata';
import { SettingType } from '@rocket.chat/apps-engine/definition/settings';
import { CoinFlipCommand } from './commands/CoinFlipCommand';
import { CoinFlipGetter } from './helper/CoinFlipGetter';
export class CoinFlipApp extends App {
private readonly coinFlipGetter: CoinFlipGetter;
constructor(info: IAppInfo, logger: ILogger) {
super(info, logger);
this.coinFlipGetter = new CoinFlipGetter();
}
protected async extendConfiguration(configuration: IConfigurationExtend, environmentRead: IEnvironmentRead): Promise<void> {
await configuration.settings.provideSetting({
id: 'coinflip_name',
type: SettingType.STRING,
packageValue: 'coinflip',
required: true,
public: false,
i18nLabel: 'Customize_Name',
i18nDescription: 'Customize_Name_Description',
});
await configuration.settings.provideSetting({
id: 'coinflip_icon',
type: SettingType.STRING,
packageValue: 'https://raw.githubusercontent.com/tgardner851/Rocket.Chat.App-base64/master/icon.jpg',
required: true,
public: false,
i18nLabel: 'Customize_Icon',
i18nDescription: 'Customize_Icon_Description',
});
await configuration.slashCommands.provideSlashCommand(new CoinFlipCommand(this.coinFlipGetter));
}
}