|
1 | | -import { |
2 | | - IHttp, |
3 | | - IModify, |
4 | | - IPersistence, |
5 | | - IRead, |
6 | | -} from "@rocket.chat/apps-engine/definition/accessors"; |
7 | | -import { |
8 | | - ISlashCommand, |
9 | | - SlashCommandContext, |
10 | | -} from "@rocket.chat/apps-engine/definition/slashcommands"; |
11 | | -import { findSimilarModal } from "../modals/findSimilarModal"; |
12 | | -import { persistUIData } from "../utils/persistenceHandlers"; |
13 | | - |
14 | | -export class FindSimilarCommand implements ISlashCommand { |
15 | | - public command = "rcc-findsimilar"; |
16 | | - public i18nParamsExample = ""; |
17 | | - public i18nDescription = ""; |
18 | | - public providesPreview = false; |
19 | | - |
20 | | - public async executor( |
21 | | - context: SlashCommandContext, |
22 | | - read: IRead, |
23 | | - modify: IModify, |
24 | | - http: IHttp, |
25 | | - persistence: IPersistence |
26 | | - ): Promise<void> { |
27 | | - const userID = context.getSender().id; |
28 | | - await persistUIData(persistence, userID, context); |
29 | | - |
30 | | - const triggerId = context.getTriggerId(); |
31 | | - if (!triggerId) { |
32 | | - throw new Error("No trigger ID provided"); |
33 | | - } |
34 | | - |
35 | | - await modify |
36 | | - .getUiController() |
37 | | - .openSurfaceView( |
38 | | - await findSimilarModal(), |
39 | | - { triggerId }, |
40 | | - context.getSender() |
41 | | - ); |
42 | | - } |
43 | | -} |
| 1 | +import { |
| 2 | + IHttp, |
| 3 | + IModify, |
| 4 | + IPersistence, |
| 5 | + IRead, |
| 6 | +} from "@rocket.chat/apps-engine/definition/accessors"; |
| 7 | +import { |
| 8 | + ISlashCommand, |
| 9 | + SlashCommandContext, |
| 10 | +} from "@rocket.chat/apps-engine/definition/slashcommands"; |
| 11 | +import { findSimilarModal } from "../modals/findSimilarModal"; |
| 12 | +import { persistUIData } from "../utils/persistenceHandlers"; |
| 13 | + |
| 14 | +export class FindSimilarCommand implements ISlashCommand { |
| 15 | + public command = "rcc-findsimilar"; |
| 16 | + public i18nParamsExample = ""; |
| 17 | + public i18nDescription = ""; |
| 18 | + public providesPreview = false; |
| 19 | + |
| 20 | + public async executor( |
| 21 | + context: SlashCommandContext, |
| 22 | + read: IRead, |
| 23 | + modify: IModify, |
| 24 | + http: IHttp, |
| 25 | + persistence: IPersistence |
| 26 | + ): Promise<void> { |
| 27 | + const userID = context.getSender().id; |
| 28 | + await persistUIData(persistence, userID, context); |
| 29 | + |
| 30 | + const triggerId = context.getTriggerId(); |
| 31 | + if (!triggerId) { |
| 32 | + throw new Error("No trigger ID provided"); |
| 33 | + } |
| 34 | + |
| 35 | + await modify |
| 36 | + .getUiController() |
| 37 | + .openSurfaceView( |
| 38 | + await findSimilarModal(), |
| 39 | + { triggerId }, |
| 40 | + context.getSender() |
| 41 | + ); |
| 42 | + } |
| 43 | +} |
0 commit comments