forked from wreiske/Rocket.Chat.App-Giphy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Giphy.ts
65 lines (59 loc) · 2.27 KB
/
Giphy.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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 { GiphyCommand } from './commands/GiphyCommand';
import { GifGetter } from './helpers/GifGetter';
export class GiphyApp extends App {
private gifGetter: GifGetter;
constructor(info: IAppInfo, logger: ILogger) {
super(info, logger);
this.gifGetter = new GifGetter();
}
public getGifGetter(): GifGetter {
return this.gifGetter;
}
protected async extendConfiguration(configuration: IConfigurationExtend, environmentRead: IEnvironmentRead): Promise<void> {
await configuration.settings.provideSetting({
id: 'giphy_apikey',
type: SettingType.STRING,
packageValue: '',
required: true,
public: false,
i18nLabel: 'Customize_GIPHY_APIKey',
i18nDescription: 'Customize_GIPHY_APIKey_Description',
});
await configuration.settings.provideSetting({
id: 'giphy_lang_code',
type: SettingType.STRING,
packageValue: 'en',
required: true,
public: false,
i18nLabel: 'Customize_GIPHY_Language',
i18nDescription: 'Customize_GIPHY_Language_Description',
});
await configuration.settings.provideSetting({
id: 'giphy_rating',
type: SettingType.STRING,
packageValue: 'G',
required: true,
public: false,
i18nLabel: 'Customize_GIPHY_Rating',
i18nDescription: 'Customize_GIPHY_Rating_Description',
});
await configuration.settings.provideSetting({
id: 'giphy_show_title',
type: SettingType.BOOLEAN,
packageValue: true,
required: true,
public: false,
i18nLabel: 'Customize_GIPHY_Show_Title',
i18nDescription: 'Customize_GIPHY_Show_Title_Description',
});
await configuration.slashCommands.provideSlashCommand(new GiphyCommand(this));
}
}