Fix cmd descriptions

This commit is contained in:
Ajay Bura 2022-08-29 19:04:44 +05:30
parent cb5e8812e4
commit 180b908bd0

View file

@ -2,7 +2,6 @@ import React from 'react';
import './commands.scss'; import './commands.scss';
import initMatrix from '../../../client/initMatrix'; import initMatrix from '../../../client/initMatrix';
import { toggleMarkdown } from '../../../client/action/settings';
import * as roomActions from '../../../client/action/room'; import * as roomActions from '../../../client/action/room';
import { hasDMWith, hasDevices } from '../../../util/matrixUtil'; import { hasDMWith, hasDevices } from '../../../util/matrixUtil';
import { selectRoom, openReusableDialog } from '../../../client/action/navigation'; import { selectRoom, openReusableDialog } from '../../../client/action/navigation';
@ -39,14 +38,9 @@ const commands = {
// eslint-disable-next-line no-use-before-define // eslint-disable-next-line no-use-before-define
exe: () => openHelpDialog(), exe: () => openHelpDialog(),
}, },
markdown: {
name: 'markdown',
description: 'Toggle markdown for messages',
exe: () => toggleMarkdown(),
},
startdm: { startdm: {
name: 'startdm', name: 'startdm',
description: 'Start DM with user id. Example: /startdm @johndoe.matrix.org', description: 'Start DM with user. Example: /startdm @johndoe.matrix.org (Accept multiple MXID)',
exe: async (roomId, data) => { exe: async (roomId, data) => {
const mx = initMatrix.matrixClient; const mx = initMatrix.matrixClient;
const rawIds = data.split(' '); const rawIds = data.split(' ');
@ -67,7 +61,7 @@ const commands = {
}, },
join: { join: {
name: 'join', name: 'join',
description: 'Join room with alias. Example: /join #cinny:matrix.org', description: 'Join room with alias. Example: /join #cinny:matrix.org (Accept multiple alias)',
exe: (roomId, data) => { exe: (roomId, data) => {
const rawIds = data.split(' '); const rawIds = data.split(' ');
const roomIds = rawIds.filter((id) => id.match(ROOM_ID_ALIAS_REG)); const roomIds = rawIds.filter((id) => id.match(ROOM_ID_ALIAS_REG));
@ -76,7 +70,7 @@ const commands = {
}, },
leave: { leave: {
name: 'leave', name: 'leave',
description: 'Leave room', description: 'Leave current room.',
exe: (roomId, data) => { exe: (roomId, data) => {
if (data.trim() === '') { if (data.trim() === '') {
roomActions.leave(roomId); roomActions.leave(roomId);
@ -89,7 +83,7 @@ const commands = {
}, },
invite: { invite: {
name: 'invite', name: 'invite',
description: 'Invite user to room. Example: /invite @johndoe:matrix.org', description: 'Invite user to room. Example: /invite @johndoe:matrix.org (Accept multiple MXID)',
exe: (roomId, data) => { exe: (roomId, data) => {
const rawIds = data.split(' '); const rawIds = data.split(' ');
const userIds = rawIds.filter((id) => id.match(MXID_REG)); const userIds = rawIds.filter((id) => id.match(MXID_REG));
@ -98,7 +92,7 @@ const commands = {
}, },
disinvite: { disinvite: {
name: 'disinvite', name: 'disinvite',
description: 'Disinvite user to room. Example: /disinvite @johndoe:matrix.org', description: 'Disinvite user to room. Example: /disinvite @johndoe:matrix.org (Accept multiple MXID)',
exe: (roomId, data) => { exe: (roomId, data) => {
const rawIds = data.split(' '); const rawIds = data.split(' ');
const userIds = rawIds.filter((id) => id.match(MXID_REG)); const userIds = rawIds.filter((id) => id.match(MXID_REG));
@ -107,7 +101,7 @@ const commands = {
}, },
kick: { kick: {
name: 'kick', name: 'kick',
description: 'Kick user from room. Example: /kick @johndoe:matrix.org', description: 'Kick user from room. Example: /kick @johndoe:matrix.org (Accept multiple MXID)',
exe: (roomId, data) => { exe: (roomId, data) => {
const rawIds = data.split(' '); const rawIds = data.split(' ');
const userIds = rawIds.filter((id) => id.match(MXID_REG)); const userIds = rawIds.filter((id) => id.match(MXID_REG));
@ -116,7 +110,7 @@ const commands = {
}, },
ban: { ban: {
name: 'ban', name: 'ban',
description: 'Ban user from room. Example: /ban @johndoe:matrix.org', description: 'Ban user from room. Example: /ban @johndoe:matrix.org (Accept multiple MXID)',
exe: (roomId, data) => { exe: (roomId, data) => {
const rawIds = data.split(' '); const rawIds = data.split(' ');
const userIds = rawIds.filter((id) => id.match(MXID_REG)); const userIds = rawIds.filter((id) => id.match(MXID_REG));
@ -125,7 +119,7 @@ const commands = {
}, },
unban: { unban: {
name: 'unban', name: 'unban',
description: 'Unban user from room. Example: /unban @johndoe:matrix.org', description: 'Unban user from room. Example: /unban @johndoe:matrix.org (Accept multiple MXID)',
exe: (roomId, data) => { exe: (roomId, data) => {
const rawIds = data.split(' '); const rawIds = data.split(' ');
const userIds = rawIds.filter((id) => id.match(MXID_REG)); const userIds = rawIds.filter((id) => id.match(MXID_REG));
@ -134,7 +128,7 @@ const commands = {
}, },
ignore: { ignore: {
name: 'ignore', name: 'ignore',
description: 'Ignore user. Example: /ignore @johndoe:matrix.org', description: 'Ignore user. Example: /ignore @johndoe:matrix.org (Accept multiple MXID)',
exe: (roomId, data) => { exe: (roomId, data) => {
const rawIds = data.split(' '); const rawIds = data.split(' ');
const userIds = rawIds.filter((id) => id.match(MXID_REG)); const userIds = rawIds.filter((id) => id.match(MXID_REG));
@ -143,7 +137,7 @@ const commands = {
}, },
unignore: { unignore: {
name: 'unignore', name: 'unignore',
description: 'Unignore user. Example: /unignore @johndoe:matrix.org', description: 'Unignore user. Example: /unignore @johndoe:matrix.org (Accept multiple MXID)',
exe: (roomId, data) => { exe: (roomId, data) => {
const rawIds = data.split(' '); const rawIds = data.split(' ');
const userIds = rawIds.filter((id) => id.match(MXID_REG)); const userIds = rawIds.filter((id) => id.match(MXID_REG));