Skip to content
Snippets Groups Projects
Commit d0de9062 authored by Gabriel Engel's avatar Gabriel Engel Committed by GitHub
Browse files

Merge pull request #4360 from RocketChat/improvement/ignore-unknown-slashcommands-optional

Added setting to allow the sending of unrecognized slash commands
parents 8de7a8fc 08ddd450
No related branches found
No related tags found
No related merge requests found
...@@ -750,6 +750,7 @@ ...@@ -750,6 +750,7 @@
"Message_AllowDeleting" : "Allow Message Deleting", "Message_AllowDeleting" : "Allow Message Deleting",
"Message_AllowDeleting_BlockDeleteInMinutes" : "Block Message Deleting After (n) Minutes", "Message_AllowDeleting_BlockDeleteInMinutes" : "Block Message Deleting After (n) Minutes",
"Message_AllowDeleting_BlockDeleteInMinutes_Description" : "Enter 0 to disable blocking.", "Message_AllowDeleting_BlockDeleteInMinutes_Description" : "Enter 0 to disable blocking.",
"Message_AllowUnrecognizedSlashCommand" : "Allow Unrecognized Slash Commands",
"Message_AllowEditing" : "Allow Message Editing", "Message_AllowEditing" : "Allow Message Editing",
"Message_AllowEditing_BlockEditInMinutes" : "Block Message Editing After (n) Minutes", "Message_AllowEditing_BlockEditInMinutes" : "Block Message Editing After (n) Minutes",
"Message_AllowEditing_BlockEditInMinutesDescription" : "Enter 0 to disable blocking.", "Message_AllowEditing_BlockEditInMinutesDescription" : "Enter 0 to disable blocking.",
......
...@@ -167,6 +167,7 @@ RocketChat.settings.addGroup 'Message', -> ...@@ -167,6 +167,7 @@ RocketChat.settings.addGroup 'Message', ->
@add 'Message_AllowEditing_BlockEditInMinutes', 0, { type: 'int', public: true, i18nDescription: 'Message_AllowEditing_BlockEditInMinutesDescription' } @add 'Message_AllowEditing_BlockEditInMinutes', 0, { type: 'int', public: true, i18nDescription: 'Message_AllowEditing_BlockEditInMinutesDescription' }
@add 'Message_AllowDeleting', true, { type: 'boolean', public: true } @add 'Message_AllowDeleting', true, { type: 'boolean', public: true }
@add 'Message_AllowDeleting_BlockDeleteInMinutes', 0, { type: 'int', public: true, i18nDescription: 'Message_AllowDeleting_BlockDeleteInMinutes' } @add 'Message_AllowDeleting_BlockDeleteInMinutes', 0, { type: 'int', public: true, i18nDescription: 'Message_AllowDeleting_BlockDeleteInMinutes' }
@add 'Message_AllowUnrecognizedSlashCommand', false, { type: 'boolean', public: true}
@add 'Message_AlwaysSearchRegExp', false, { type: 'boolean' } @add 'Message_AlwaysSearchRegExp', false, { type: 'boolean' }
@add 'Message_ShowEditedStatus', true, { type: 'boolean', public: true } @add 'Message_ShowEditedStatus', true, { type: 'boolean', public: true }
@add 'Message_ShowDeletedStatus', false, { type: 'boolean', public: true } @add 'Message_ShowDeletedStatus', false, { type: 'boolean', public: true }
......
...@@ -186,16 +186,18 @@ class @ChatMessages ...@@ -186,16 +186,18 @@ class @ChatMessages
else else
Meteor.call 'slashCommand', {cmd: command, params: param, msg: msgObject } Meteor.call 'slashCommand', {cmd: command, params: param, msg: msgObject }
return return
invalidCommandMsg =
_id: Random.id() if !RocketChat.settings.get('Message_AllowUnrecognizedSlashCommand')
rid: rid invalidCommandMsg =
ts: new Date _id: Random.id()
msg: TAPi18n.__('No_such_command', { command: match[1] }) rid: rid
u: ts: new Date
username: "rocketbot" msg: TAPi18n.__('No_such_command', { command: match[1] })
private: true u:
ChatMessage.upsert { _id: invalidCommandMsg._id }, invalidCommandMsg username: "rocketbot"
return private: true
ChatMessage.upsert { _id: invalidCommandMsg._id }, invalidCommandMsg
return
Meteor.call 'sendMessage', msgObject Meteor.call 'sendMessage', msgObject
done() done()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment