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/apps/meteor/app/slashcommands-topic/server/topic.ts

19 lines
742 B

import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings';
import { slashCommands } from '../../utils/lib/slashCommand';
import { hasPermissionAsync } from '../../authorization/server/functions/hasPermission';
import { saveRoomSettings } from '../../channel-settings/server/methods/saveRoomSettings';
slashCommands.add({
command: 'topic',
callback: async ({ params, message, userId }: SlashCommandCallbackParams<'topic'>): Promise<void> => {
if (userId && (await hasPermissionAsync(userId, 'edit-room', message.rid))) {
await saveRoomSettings(userId, message.rid, 'roomTopic', params);
}
},
options: {
description: 'Slash_Topic_Description',
params: 'Slash_Topic_Params',
permission: 'edit-room',
},
});