Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/containers/MessageBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ class MessageBox extends Component<IMessageBoxProps, IMessageBoxState> {
const messageWithoutCommand = message.replace(/([^\s]+)/, '').trim();
const [{ appId }] = slashCommand;
const triggerId = generateTriggerId(appId);
RocketChat.runSlashCommand(command, roomId, messageWithoutCommand, triggerId, tmid || messageTmid);
await RocketChat.runSlashCommand(command, roomId, messageWithoutCommand, triggerId, tmid || messageTmid);
replyCancel();
} catch (e) {
logEvent(events.COMMAND_RUN_F);
Expand Down
5 changes: 5 additions & 0 deletions app/definitions/rest/v1/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type CommandsEndpoints = {
'commands.run': {
POST: (params: { command: string; roomId: string; params: string; triggerId?: string; tmid?: string }) => {};
};
};
4 changes: 3 additions & 1 deletion app/definitions/rest/v1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { TeamsEndpoints } from './teams';
import { E2eEndpoints } from './e2e';
import { SubscriptionsEndpoints } from './subscriptions';
import { VideoConferenceEndpoints } from './videoConference';
import { CommandsEndpoints } from './commands';

export type Endpoints = ChannelsEndpoints &
ChatEndpoints &
Expand All @@ -34,4 +35,5 @@ export type Endpoints = ChannelsEndpoints &
TeamsEndpoints &
E2eEndpoints &
SubscriptionsEndpoints &
VideoConferenceEndpoints;
VideoConferenceEndpoints &
CommandsEndpoints;
4 changes: 1 addition & 3 deletions app/lib/rocketchat/services/restApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,10 +673,8 @@ export const getSyncThreadsList = ({ rid, updatedSince }: { rid: string; updated
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
// TODO: missing definitions from server
// @ts-ignore
sdk.post('commands.run', {
command,
roomId,
Expand Down