diff --git a/packages/rocketchat-models/server/models/Messages.js b/packages/rocketchat-models/server/models/Messages.js index b8956f63d89b..a85e64182430 100644 --- a/packages/rocketchat-models/server/models/Messages.js +++ b/packages/rocketchat-models/server/models/Messages.js @@ -41,6 +41,10 @@ export class Messages extends Base { return this.createWithTypeRoomIdMessageAndUser('room-archived', roomId, '', user); } + createRoomUnarchivedByRoomIdAndUser(roomId, user) { + return this.createWithTypeRoomIdMessageAndUser('room-unarchived', roomId, '', user); + } + unsetReactions(messageId) { return this.update({ _id: messageId }, { $unset: { reactions: 1 } }); } diff --git a/packages/rocketchat-slashcommands-kick/client/client.js b/packages/rocketchat-slashcommands-kick/client/client.js index 15868bd81efd..b4ec4b3a17a8 100644 --- a/packages/rocketchat-slashcommands-kick/client/client.js +++ b/packages/rocketchat-slashcommands-kick/client/client.js @@ -1,6 +1,6 @@ -import { RocketChat } from 'meteor/rocketchat:lib'; +import { slashCommands } from 'meteor/rocketchat:utils'; -RocketChat.slashCommands.add('kick', function(command, params) { +slashCommands.add('kick', function(command, params) { const username = params.trim(); if (username === '') { return; diff --git a/packages/rocketchat-slashcommands-kick/package.js b/packages/rocketchat-slashcommands-kick/package.js index 69ffed31f8df..48ca20a78c49 100644 --- a/packages/rocketchat-slashcommands-kick/package.js +++ b/packages/rocketchat-slashcommands-kick/package.js @@ -9,7 +9,9 @@ Package.onUse(function(api) { api.use([ 'ecmascript', 'check', - 'rocketchat:lib', + 'rocketchat:utils', + 'rocketchat:notifications', + 'rocketchat:models', 'templating', ]); api.mainModule('client/index.js', 'client'); diff --git a/packages/rocketchat-slashcommands-kick/server/server.js b/packages/rocketchat-slashcommands-kick/server/server.js index 71d1b0e79ebd..45b341400886 100644 --- a/packages/rocketchat-slashcommands-kick/server/server.js +++ b/packages/rocketchat-slashcommands-kick/server/server.js @@ -4,7 +4,9 @@ import { Meteor } from 'meteor/meteor'; import { Match } from 'meteor/check'; import { Random } from 'meteor/random'; import { TAPi18n } from 'meteor/tap:i18n'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { Notifications } from 'meteor/rocketchat:notifications'; +import { Users, Subscriptions } from 'meteor/rocketchat:models'; +import { slashCommands } from 'meteor/rocketchat:utils'; const Kick = function(command, params, { rid }) { if (command !== 'kick' || !Match.test(params, String)) { @@ -16,10 +18,10 @@ const Kick = function(command, params, { rid }) { } const userId = Meteor.userId(); const user = Meteor.users.findOne(userId); - const kickedUser = RocketChat.models.Users.findOneByUsername(username); + const kickedUser = Users.findOneByUsername(username); if (kickedUser == null) { - return RocketChat.Notifications.notifyUser(userId, 'message', { + return Notifications.notifyUser(userId, 'message', { _id: Random.id(), rid, ts: new Date, @@ -30,9 +32,9 @@ const Kick = function(command, params, { rid }) { }); } - const subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(rid, user._id, { fields: { _id: 1 } }); + const subscription = Subscriptions.findOneByRoomIdAndUserId(rid, user._id, { fields: { _id: 1 } }); if (!subscription) { - return RocketChat.Notifications.notifyUser(userId, 'message', { + return Notifications.notifyUser(userId, 'message', { _id: Random.id(), rid, ts: new Date, @@ -45,7 +47,7 @@ const Kick = function(command, params, { rid }) { Meteor.call('removeUserFromRoom', { rid, username }); }; -RocketChat.slashCommands.add('kick', Kick, { +slashCommands.add('kick', Kick, { description: 'Remove_someone_from_room', params: '@username', permission: 'remove-user', diff --git a/packages/rocketchat-slashcommands-leave/package.js b/packages/rocketchat-slashcommands-leave/package.js index f747d1bda029..115f83fab1fc 100644 --- a/packages/rocketchat-slashcommands-leave/package.js +++ b/packages/rocketchat-slashcommands-leave/package.js @@ -8,7 +8,8 @@ Package.describe({ Package.onUse(function(api) { api.use([ 'ecmascript', - 'rocketchat:lib', + 'rocketchat:utils', + 'rocketchat:notifications', ]); api.mainModule('server/index.js', 'server'); }); diff --git a/packages/rocketchat-slashcommands-leave/server/leave.js b/packages/rocketchat-slashcommands-leave/server/leave.js index 3f0d07ac3d42..a3510b410d97 100644 --- a/packages/rocketchat-slashcommands-leave/server/leave.js +++ b/packages/rocketchat-slashcommands-leave/server/leave.js @@ -1,7 +1,8 @@ import { Meteor } from 'meteor/meteor'; import { Random } from 'meteor/random'; import { TAPi18n } from 'meteor/tap:i18n'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { Notifications } from 'meteor/rocketchat:notifications'; +import { slashCommands } from 'meteor/rocketchat:utils'; /* * Leave is a named function that will replace /leave commands @@ -15,7 +16,7 @@ function Leave(command, params, item) { try { Meteor.call('leaveRoom', item.rid); } catch ({ error }) { - RocketChat.Notifications.notifyUser(Meteor.userId(), 'message', { + Notifications.notifyUser(Meteor.userId(), 'message', { _id: Random.id(), rid: item.rid, ts: new Date, @@ -24,5 +25,5 @@ function Leave(command, params, item) { } } -RocketChat.slashCommands.add('leave', Leave, { description: 'Leave_the_current_channel' }); -RocketChat.slashCommands.add('part', Leave, { description: 'Leave_the_current_channel' }); +slashCommands.add('leave', Leave, { description: 'Leave_the_current_channel' }); +slashCommands.add('part', Leave, { description: 'Leave_the_current_channel' }); diff --git a/packages/rocketchat-slashcommands-me/package.js b/packages/rocketchat-slashcommands-me/package.js index 92e6c9891642..1920b2678726 100644 --- a/packages/rocketchat-slashcommands-me/package.js +++ b/packages/rocketchat-slashcommands-me/package.js @@ -8,7 +8,7 @@ Package.describe({ Package.onUse(function(api) { api.use([ 'ecmascript', - 'rocketchat:lib', + 'rocketchat:utils', ]); api.mainModule('server/index.js', 'server'); }); diff --git a/packages/rocketchat-slashcommands-me/server/me.js b/packages/rocketchat-slashcommands-me/server/me.js index b02dcd1cdfd0..d3d8242e9b5e 100644 --- a/packages/rocketchat-slashcommands-me/server/me.js +++ b/packages/rocketchat-slashcommands-me/server/me.js @@ -1,12 +1,12 @@ import { Meteor } from 'meteor/meteor'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { slashCommands } from 'meteor/rocketchat:utils'; import s from 'underscore.string'; /* * Me is a named function that will replace /me commands * @param {Object} message - The message object */ -RocketChat.slashCommands.add('me', function Me(command, params, item) { +slashCommands.add('me', function Me(command, params, item) { if (command !== 'me') { return; } diff --git a/packages/rocketchat-slashcommands-msg/package.js b/packages/rocketchat-slashcommands-msg/package.js index 77c36632bbbf..6c25c9b1f302 100644 --- a/packages/rocketchat-slashcommands-msg/package.js +++ b/packages/rocketchat-slashcommands-msg/package.js @@ -9,7 +9,9 @@ Package.onUse(function(api) { api.use([ 'ecmascript', 'check', - 'rocketchat:lib', + 'rocketchat:utils', + 'rocketchat:models', + 'rocketchat:notifications', 'templating', ]); api.mainModule('server/index.js', 'server'); diff --git a/packages/rocketchat-slashcommands-msg/server/server.js b/packages/rocketchat-slashcommands-msg/server/server.js index 9af2bbb2b30f..caacc12692af 100644 --- a/packages/rocketchat-slashcommands-msg/server/server.js +++ b/packages/rocketchat-slashcommands-msg/server/server.js @@ -2,7 +2,9 @@ import { Meteor } from 'meteor/meteor'; import { Match } from 'meteor/check'; import { Random } from 'meteor/random'; import { TAPi18n } from 'meteor/tap:i18n'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { slashCommands } from 'meteor/rocketchat:utils'; +import { Notifications } from 'meteor/rocketchat:notifications'; +import { Users } from 'meteor/rocketchat:models'; /* * Msg is a named function that will replace /msg commands @@ -16,7 +18,7 @@ function Msg(command, params, item) { const separator = trimmedParams.indexOf(' '); const user = Meteor.users.findOne(Meteor.userId()); if (separator === -1) { - return RocketChat.Notifications.notifyUser(Meteor.userId(), 'message', { + return Notifications.notifyUser(Meteor.userId(), 'message', { _id: Random.id(), rid: item.rid, ts: new Date, @@ -26,9 +28,9 @@ function Msg(command, params, item) { const message = trimmedParams.slice(separator + 1); const targetUsernameOrig = trimmedParams.slice(0, separator); const targetUsername = targetUsernameOrig.replace('@', ''); - const targetUser = RocketChat.models.Users.findOneByUsername(targetUsername); + const targetUser = Users.findOneByUsername(targetUsername); if (targetUser == null) { - RocketChat.Notifications.notifyUser(Meteor.userId(), 'message', { + Notifications.notifyUser(Meteor.userId(), 'message', { _id: Random.id(), rid: item.rid, ts: new Date, @@ -48,7 +50,7 @@ function Msg(command, params, item) { Meteor.call('sendMessage', msgObject); } -RocketChat.slashCommands.add('msg', Msg, { +slashCommands.add('msg', Msg, { description: 'Direct_message_someone', params: '@username ', }); diff --git a/packages/rocketchat-slashcommands-mute/package.js b/packages/rocketchat-slashcommands-mute/package.js index 8e2caf22319a..d04f51ea5712 100644 --- a/packages/rocketchat-slashcommands-mute/package.js +++ b/packages/rocketchat-slashcommands-mute/package.js @@ -9,7 +9,9 @@ Package.onUse(function(api) { api.use([ 'ecmascript', 'check', - 'rocketchat:lib', + 'rocketchat:utils', + 'rocketchat:notifications', + 'rocketchat:models', ]); api.mainModule('server/index.js', 'server'); }); diff --git a/packages/rocketchat-slashcommands-mute/server/mute.js b/packages/rocketchat-slashcommands-mute/server/mute.js index 31dc84923ce1..b04028482092 100644 --- a/packages/rocketchat-slashcommands-mute/server/mute.js +++ b/packages/rocketchat-slashcommands-mute/server/mute.js @@ -2,13 +2,15 @@ import { Meteor } from 'meteor/meteor'; import { Match } from 'meteor/check'; import { Random } from 'meteor/random'; import { TAPi18n } from 'meteor/tap:i18n'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { slashCommands } from 'meteor/rocketchat:utils'; +import { Users, Subscriptions } from 'meteor/rocketchat:models'; +import { Notifications } from 'meteor/rocketchat:notifications'; /* * Mute is a named function that will replace /mute commands */ -RocketChat.slashCommands.add('mute', function Mute(command, params, item) { +slashCommands.add('mute', function Mute(command, params, item) { if (command !== 'mute' || !Match.test(params, String)) { return; } @@ -18,9 +20,9 @@ RocketChat.slashCommands.add('mute', function Mute(command, params, item) { } const userId = Meteor.userId(); const user = Meteor.users.findOne(userId); - const mutedUser = RocketChat.models.Users.findOneByUsername(username); + const mutedUser = Users.findOneByUsername(username); if (mutedUser == null) { - RocketChat.Notifications.notifyUser(userId, 'message', { + Notifications.notifyUser(userId, 'message', { _id: Random.id(), rid: item.rid, ts: new Date, @@ -32,9 +34,9 @@ RocketChat.slashCommands.add('mute', function Mute(command, params, item) { return; } - const subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(item.rid, mutedUser._id, { fields: { _id: 1 } }); + const subscription = Subscriptions.findOneByRoomIdAndUserId(item.rid, mutedUser._id, { fields: { _id: 1 } }); if (!subscription) { - RocketChat.Notifications.notifyUser(userId, 'message', { + Notifications.notifyUser(userId, 'message', { _id: Random.id(), rid: item.rid, ts: new Date, diff --git a/packages/rocketchat-slashcommands-mute/server/unmute.js b/packages/rocketchat-slashcommands-mute/server/unmute.js index bb049d7746a0..b2a27df0aa5d 100644 --- a/packages/rocketchat-slashcommands-mute/server/unmute.js +++ b/packages/rocketchat-slashcommands-mute/server/unmute.js @@ -2,13 +2,15 @@ import { Meteor } from 'meteor/meteor'; import { Match } from 'meteor/check'; import { Random } from 'meteor/random'; import { TAPi18n } from 'meteor/tap:i18n'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { slashCommands } from 'meteor/rocketchat:utils'; +import { Users, Subscriptions } from 'meteor/rocketchat:models'; +import { Notifications } from 'meteor/rocketchat:notifications'; /* * Unmute is a named function that will replace /unmute commands */ -RocketChat.slashCommands.add('unmute', function Unmute(command, params, item) { +slashCommands.add('unmute', function Unmute(command, params, item) { if (command !== 'unmute' || !Match.test(params, String)) { return; @@ -18,9 +20,9 @@ RocketChat.slashCommands.add('unmute', function Unmute(command, params, item) { return; } const user = Meteor.users.findOne(Meteor.userId()); - const unmutedUser = RocketChat.models.Users.findOneByUsername(username); + const unmutedUser = Users.findOneByUsername(username); if (unmutedUser == null) { - return RocketChat.Notifications.notifyUser(Meteor.userId(), 'message', { + return Notifications.notifyUser(Meteor.userId(), 'message', { _id: Random.id(), rid: item.rid, ts: new Date, @@ -31,9 +33,9 @@ RocketChat.slashCommands.add('unmute', function Unmute(command, params, item) { }); } - const subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(item.rid, unmutedUser._id, { fields: { _id: 1 } }); + const subscription = Subscriptions.findOneByRoomIdAndUserId(item.rid, unmutedUser._id, { fields: { _id: 1 } }); if (!subscription) { - return RocketChat.Notifications.notifyUser(Meteor.userId(), 'message', { + return Notifications.notifyUser(Meteor.userId(), 'message', { _id: Random.id(), rid: item.rid, ts: new Date, diff --git a/packages/rocketchat-slashcommands-open/client/client.js b/packages/rocketchat-slashcommands-open/client/client.js index a7d8b05b11a0..c53312a4b181 100644 --- a/packages/rocketchat-slashcommands-open/client/client.js +++ b/packages/rocketchat-slashcommands-open/client/client.js @@ -1,8 +1,8 @@ import { Meteor } from 'meteor/meteor'; import { Match } from 'meteor/check'; import { FlowRouter } from 'meteor/kadira:flow-router'; -import { RocketChat } from 'meteor/rocketchat:lib'; -import { ChatSubscription } from 'meteor/rocketchat:ui'; +import { slashCommands, roomTypes } from 'meteor/rocketchat:utils'; +import { ChatSubscription, Subscriptions } from 'meteor/rocketchat:models'; function Open(command, params /* , item*/) { const dict = { @@ -31,7 +31,7 @@ function Open(command, params /* , item*/) { const subscription = ChatSubscription.findOne(query); if (subscription) { - RocketChat.roomTypes.openRouteLink(subscription.t, subscription, FlowRouter.current().queryParams); + roomTypes.openRouteLink(subscription.t, subscription, FlowRouter.current().queryParams); } if (type && type.indexOf('d') === -1) { @@ -41,13 +41,13 @@ function Open(command, params /* , item*/) { if (err) { return; } - const subscription = RocketChat.models.Subscriptions.findOne(query); - RocketChat.roomTypes.openRouteLink(subscription.t, subscription, FlowRouter.current().queryParams); + const subscription = Subscriptions.findOne(query); + roomTypes.openRouteLink(subscription.t, subscription, FlowRouter.current().queryParams); }); } -RocketChat.slashCommands.add('open', Open, { +slashCommands.add('open', Open, { description: 'Opens_a_channel_group_or_direct_message', params: 'room_name', clientOnly: true, diff --git a/packages/rocketchat-slashcommands-open/package.js b/packages/rocketchat-slashcommands-open/package.js index 2aa1b6ed8455..339f1097ba20 100644 --- a/packages/rocketchat-slashcommands-open/package.js +++ b/packages/rocketchat-slashcommands-open/package.js @@ -9,7 +9,8 @@ Package.onUse(function(api) { api.use([ 'ecmascript', 'check', - 'rocketchat:lib', + 'rocketchat:utils', + 'rocketchat:models', 'kadira:flow-router', 'templating', ]); diff --git a/packages/rocketchat-slashcommands-topic/lib/topic.js b/packages/rocketchat-slashcommands-topic/lib/topic.js index 8824f3a85cc2..16a06d62aaa1 100644 --- a/packages/rocketchat-slashcommands-topic/lib/topic.js +++ b/packages/rocketchat-slashcommands-topic/lib/topic.js @@ -1,6 +1,8 @@ import { Meteor } from 'meteor/meteor'; -import { RocketChat, handleError } from 'meteor/rocketchat:lib'; -import { ChatRoom } from 'meteor/rocketchat:ui'; +import { handleError, slashCommands } from 'meteor/rocketchat:utils'; +import { ChatRoom } from 'meteor/rocketchat:models'; +import { callbacks } from 'meteor/rocketchat:callbacks'; +import { hasPermission } from 'meteor/rocketchat:authorization'; /* * Join is a named function that will replace /topic commands * @param {Object} message - The message object @@ -8,7 +10,7 @@ import { ChatRoom } from 'meteor/rocketchat:ui'; function Topic(command, params, item) { if (command === 'topic') { - if ((Meteor.isClient && RocketChat.authz.hasPermission('edit-room', item.rid)) || (Meteor.isServer && RocketChat.authz.hasPermission(Meteor.userId(), 'edit-room', item.rid))) { + if ((Meteor.isClient && hasPermission('edit-room', item.rid)) || (Meteor.isServer && hasPermission(Meteor.userId(), 'edit-room', item.rid))) { Meteor.call('saveRoomSettings', item.rid, 'roomTopic', params, (err) => { if (err) { if (Meteor.isClient) { @@ -19,14 +21,14 @@ function Topic(command, params, item) { } if (Meteor.isClient) { - RocketChat.callbacks.run('roomTopicChanged', ChatRoom.findOne(item.rid)); + callbacks.run('roomTopicChanged', ChatRoom.findOne(item.rid)); } }); } } } -RocketChat.slashCommands.add('topic', Topic, { +slashCommands.add('topic', Topic, { description: 'Slash_Topic_Description', params: 'Slash_Topic_Params', }); diff --git a/packages/rocketchat-slashcommands-topic/package.js b/packages/rocketchat-slashcommands-topic/package.js index 209ccf9462b5..30552892422b 100644 --- a/packages/rocketchat-slashcommands-topic/package.js +++ b/packages/rocketchat-slashcommands-topic/package.js @@ -7,7 +7,9 @@ Package.describe({ Package.onUse(function(api) { api.use([ - 'rocketchat:lib', + 'rocketchat:utils', + 'rocketchat:models', + 'rocketchat:callbacks', 'ecmascript', 'rocketchat:authorization', ]); diff --git a/packages/rocketchat-slashcommands-unarchiveroom/client/client.js b/packages/rocketchat-slashcommands-unarchiveroom/client/client.js index 419aab3b5f51..153ccb2f5d93 100644 --- a/packages/rocketchat-slashcommands-unarchiveroom/client/client.js +++ b/packages/rocketchat-slashcommands-unarchiveroom/client/client.js @@ -1,6 +1,6 @@ -import { RocketChat } from 'meteor/rocketchat:lib'; +import { slashCommands } from 'meteor/rocketchat:utils'; -RocketChat.slashCommands.add('unarchive', null, { +slashCommands.add('unarchive', null, { description: 'Unarchive', params: '#channel', }); diff --git a/packages/rocketchat-slashcommands-unarchiveroom/package.js b/packages/rocketchat-slashcommands-unarchiveroom/package.js index ec0f7818727b..818c727ab442 100644 --- a/packages/rocketchat-slashcommands-unarchiveroom/package.js +++ b/packages/rocketchat-slashcommands-unarchiveroom/package.js @@ -9,7 +9,9 @@ Package.onUse(function(api) { api.use([ 'ecmascript', 'check', - 'rocketchat:lib', + 'rocketchat:utils', + 'rocketchat:models', + 'rocketchat:notifications', 'templating', ]); api.mainModule('client/index.js', 'client'); diff --git a/packages/rocketchat-slashcommands-unarchiveroom/server/index.js b/packages/rocketchat-slashcommands-unarchiveroom/server/index.js index 509b4bf77af8..1199af15d79f 100644 --- a/packages/rocketchat-slashcommands-unarchiveroom/server/index.js +++ b/packages/rocketchat-slashcommands-unarchiveroom/server/index.js @@ -1,2 +1 @@ -import './messages'; import './server'; diff --git a/packages/rocketchat-slashcommands-unarchiveroom/server/messages.js b/packages/rocketchat-slashcommands-unarchiveroom/server/messages.js deleted file mode 100644 index 79538c270a61..000000000000 --- a/packages/rocketchat-slashcommands-unarchiveroom/server/messages.js +++ /dev/null @@ -1,5 +0,0 @@ -import { RocketChat } from 'meteor/rocketchat:lib'; - -RocketChat.models.Messages.createRoomUnarchivedByRoomIdAndUser = function(roomId, user) { - return this.createWithTypeRoomIdMessageAndUser('room-unarchived', roomId, '', user); -}; diff --git a/packages/rocketchat-slashcommands-unarchiveroom/server/server.js b/packages/rocketchat-slashcommands-unarchiveroom/server/server.js index 4e6cc8c264c1..406c4d391323 100644 --- a/packages/rocketchat-slashcommands-unarchiveroom/server/server.js +++ b/packages/rocketchat-slashcommands-unarchiveroom/server/server.js @@ -2,7 +2,9 @@ import { Meteor } from 'meteor/meteor'; import { Match } from 'meteor/check'; import { Random } from 'meteor/random'; import { TAPi18n } from 'meteor/tap:i18n'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { Rooms, Messages } from 'meteor/rocketchat:models'; +import { slashCommands } from 'meteor/rocketchat:utils'; +import { Notifications } from 'meteor/rocketchat:notifications'; function Unarchive(command, params, item) { if (command !== 'unarchive' || !Match.test(params, String)) { @@ -13,17 +15,17 @@ function Unarchive(command, params, item) { let room; if (channel === '') { - room = RocketChat.models.Rooms.findOneById(item.rid); + room = Rooms.findOneById(item.rid); channel = room.name; } else { channel = channel.replace('#', ''); - room = RocketChat.models.Rooms.findOneByName(channel); + room = Rooms.findOneByName(channel); } const user = Meteor.users.findOne(Meteor.userId()); if (!room) { - return RocketChat.Notifications.notifyUser(Meteor.userId(), 'message', { + return Notifications.notifyUser(Meteor.userId(), 'message', { _id: Random.id(), rid: item.rid, ts: new Date(), @@ -40,7 +42,7 @@ function Unarchive(command, params, item) { } if (!room.archived) { - RocketChat.Notifications.notifyUser(Meteor.userId(), 'message', { + Notifications.notifyUser(Meteor.userId(), 'message', { _id: Random.id(), rid: item.rid, ts: new Date(), @@ -54,8 +56,8 @@ function Unarchive(command, params, item) { Meteor.call('unarchiveRoom', room._id); - RocketChat.models.Messages.createRoomUnarchivedByRoomIdAndUser(room._id, Meteor.user()); - RocketChat.Notifications.notifyUser(Meteor.userId(), 'message', { + Messages.createRoomUnarchivedByRoomIdAndUser(room._id, Meteor.user()); + Notifications.notifyUser(Meteor.userId(), 'message', { _id: Random.id(), rid: item.rid, ts: new Date(), @@ -68,7 +70,7 @@ function Unarchive(command, params, item) { return Unarchive; } -RocketChat.slashCommands.add('unarchive', Unarchive, { +slashCommands.add('unarchive', Unarchive, { description: 'Unarchive', params: '#channel', });