-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Tenor.ts
74 lines (68 loc) · 2.65 KB
/
Tenor.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
66
67
68
69
70
71
72
73
74
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 { TenorCommand } from './commands/TenorCommand';
import { ImageGetter } from './helpers/ImageGetter';
export class Tenor extends App {
private imageGetter: ImageGetter;
constructor(info: IAppInfo, logger: ILogger) {
super(info, logger);
this.imageGetter = new ImageGetter();
}
public getImageGetter(): ImageGetter {
return this.imageGetter;
}
protected async extendConfiguration(configuration: IConfigurationExtend, environmentRead: IEnvironmentRead): Promise<void> {
await configuration.settings.provideSetting({
id: 'tenor_apikey',
type: SettingType.STRING,
packageValue: '',
required: true,
public: false,
i18nLabel: 'Customize_Tenor_APIKey',
i18nDescription: 'Customize_Tenor_APIKey_Description',
});
await configuration.settings.provideSetting({
id: 'tenor_lang_code',
type: SettingType.STRING,
packageValue: 'en_US',
required: true,
public: false,
i18nLabel: 'Customize_Tenor_Language',
i18nDescription: 'Customize_Tenor_Language_Description',
});
await configuration.settings.provideSetting({
id: 'tenor_content_filter',
type: SettingType.STRING,
packageValue: 'low',
required: true,
public: false,
i18nLabel: 'Customize_Tenor_ContentFilter',
i18nDescription: 'Customize_Tenor_ContentFilter_Description',
});
await configuration.settings.provideSetting({
id: 'tenor_show_title',
type: SettingType.BOOLEAN,
packageValue: true,
required: true,
public: false,
i18nLabel: 'Customize_Tenor_Show_Title',
i18nDescription: 'Customize_Tenor_Show_Title_Description',
});
await configuration.settings.provideSetting({
id: 'tenor_show_link',
type: SettingType.BOOLEAN,
packageValue: true,
required: true,
public: false,
i18nLabel: 'Customize_Tenor_Show_Link',
i18nDescription: 'Customize_Tenor_Show_Link_Description',
});
await configuration.slashCommands.provideSlashCommand(new TenorCommand(this));
}
}