RocketChat/Rocket.Chat

View on GitHub
apps/meteor/app/slashcommand-asciiarts/server/shrug.ts

Summary

Maintainability
B
4 hrs
Test Coverage
import type { SlashCommandCallbackParams } from '@rocket.chat/core-typings';

import { executeSendMessage } from '../../lib/server/methods/sendMessage';
import { slashCommands } from '../../utils/server/slashCommand';
/*
 * Shrug is a named function that will replace /shrug commands
 * @param {Object} message - The message object
 */

slashCommands.add({
    command: 'shrug',
    callback: async ({ message, params, userId }: SlashCommandCallbackParams<'shrug'>): Promise<void> => {
        const msg = message;
        msg.msg = `${params} ¯\\\\_(ツ)_/¯`;
        await executeSendMessage(userId, msg);
    },
    options: {
        description: 'Slash_Shrug_Description',
        params: 'your_message_optional',
        clientOnly: true,
    },
});