Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added /invite slash command #648

Merged
merged 3 commits into from
Sep 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {

});