MCPcopy
hub / github.com/RocketChat/Rocket.Chat / add

Function add

apps/meteor/app/utils/client/slashCommand.ts:26–53  ·  view source on GitHub ↗
({
		command,
		callback,
		options = {},
		result,
		providesPreview = false,
		previewer,
		previewCallback,
		appId,
		description = '',
	}: ISlashCommandAddParams<T>)

Source from the content-addressed store, hash-verified

24export const slashCommands = {
25 commands: {} as Record<string, SlashCommand>,
26 add<T extends string>({
27 command,
28 callback,
29 options = {},
30 result,
31 providesPreview = false,
32 previewer,
33 previewCallback,
34 appId,
35 description = '',
36 }: ISlashCommandAddParams<T>): void {
37 if (this.commands[command]) {
38 return;
39 }
40 this.commands[command] = {
41 command,
42 callback,
43 params: options.params,
44 description: options.description || description,
45 permission: options.permission,
46 clientOnly: options.clientOnly || false,
47 result,
48 providesPreview: Boolean(providesPreview),
49 previewer,
50 previewCallback,
51 appId,
52 } as SlashCommand;
53 },
54 async run({
55 command,
56 message,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected