Skip to content

Commit

Permalink
Merge pull request #648 from geekgonecrazy/slashcommand-invite
Browse files Browse the repository at this point in the history
Added /invite slash command
  • Loading branch information
rodrigok committed Sep 1, 2015
2 parents 56b4e01 + 7686fba commit fe81ae5
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ rocketchat:ldap
rocketchat:logger
rocketchat:markdown
rocketchat:me
#rocketchat:slashcommands-invite
rocketchat:mentions
rocketchat:oembed
rocketchat:webrtc
Expand Down
19 changes: 19 additions & 0 deletions packages/rocketchat-slashcommands-invite/invite.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
###
# Invite is a named function that will replace /invite commands
# @param {Object} message - The message object
###

class Invite
constructor: (command, params, item) ->
if(command == "invite")
if _.trim params
username = params.replace('@', '')

user = Meteor.users.findOne({ username: username })

if user?
Meteor.runAsUser user._id, ->
Meteor.call 'joinRoom', item.rid


RocketChat.slashCommands.add 'invite', Invite
21 changes: 21 additions & 0 deletions packages/rocketchat-slashcommands-invite/package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Package.describe({
name: 'rocketchat:slashcommands-invite',
version: '0.0.1',
summary: 'Message pre-processor that will translate /me commands',
git: ''
});

Package.onUse(function(api) {
api.versionsFrom('1.0');

api.use([
'coffeescript',
'rocketchat:lib@0.0.1'
]);

api.addFiles('invite.coffee', ['server','client']);
});

Package.onTest(function(api) {

});

0 comments on commit fe81ae5

Please sign in to comment.