Chore: Migrate REST API - runSlashCommand to Typescript (#3893)

This commit is contained in:
Alex Junior 2022-03-15 22:14:50 -03:00 committed by GitHub
parent b9967fda9f
commit 9650c98b4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -888,7 +888,7 @@ class MessageBox extends Component<IMessageBoxProps, IMessageBoxState> {
const messageWithoutCommand = message.replace(/([^\s]+)/, '').trim(); const messageWithoutCommand = message.replace(/([^\s]+)/, '').trim();
const [{ appId }] = slashCommand; const [{ appId }] = slashCommand;
const triggerId = generateTriggerId(appId); const triggerId = generateTriggerId(appId);
RocketChat.runSlashCommand(command, roomId, messageWithoutCommand, triggerId, tmid || messageTmid); await RocketChat.runSlashCommand(command, roomId, messageWithoutCommand, triggerId, tmid || messageTmid);
replyCancel(); replyCancel();
} catch (e) { } catch (e) {
logEvent(events.COMMAND_RUN_F); logEvent(events.COMMAND_RUN_F);

View File

@ -17,4 +17,7 @@ export type CommandsEndpoints = {
tmid?: string; tmid?: string;
}) => {}; }) => {};
}; };
'commands.run': {
POST: (params: { command: string; roomId: string; params: string; triggerId?: string; tmid?: string }) => {};
};
}; };

View File

@ -677,10 +677,8 @@ export const getSyncThreadsList = ({ rid, updatedSince }: { rid: string; updated
updatedSince updatedSince
}); });
export const runSlashCommand = (command: string, roomId: string, params: any, triggerId?: string, tmid?: string): any => export const runSlashCommand = (command: string, roomId: string, params: string, triggerId?: string, tmid?: string) =>
// RC 0.60.2 // RC 0.60.2
// TODO: missing definitions from server
// @ts-ignore
sdk.post('commands.run', { sdk.post('commands.run', {
command, command,
roomId, roomId,