The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/client/startup/slashCommands.ts

20 lines
567 B

import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { slashCommands, APIClient } from '../../app/utils/client';
import { IUser } from '../../definition/IUser';
let oldUserId: IUser['_id'] | null = null;
Tracker.autorun(() => {
const newUserId = Meteor.userId();
if (oldUserId === null && newUserId) {
APIClient.v1.get('commands.list').then((result) => {
result.commands.forEach((command: { command: string }) => {
slashCommands.commands[command.command] = command;
});
});
}
oldUserId = Meteor.userId();
});