diff --git a/HISTORY.md b/HISTORY.md
index 4e732d59c737..4cb22ca5c634 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -1,4 +1,10 @@
+# NEXT
+
+### Breaking Changes
+
+- [#7095](https://github.com/RocketChat/Rocket.Chat/pull/7095) Internal hubot does not load [hubot-scripts](https://github.com/github/hubot-scripts) anymore.
+
# 0.56.0 (2017-05-15)
### New Features
@@ -51,7 +57,7 @@
- [#6780](https://github.com/RocketChat/Rocket.Chat/pull/6780) Convert Mailer Package to Js
- [#6694](https://github.com/RocketChat/Rocket.Chat/pull/6694) Convert markdown to js
- [#6689](https://github.com/RocketChat/Rocket.Chat/pull/6689) Convert Mentions-Flextab Package to Js
-- [#6781](https://github.com/RocketChat/Rocket.Chat/pull/6781) Convert Message-Star Package to js
+- [#6781](https://github.com/RocketChat/Rocket.Chat/pull/6781) Convert Message-Star Package to js
- [#6688](https://github.com/RocketChat/Rocket.Chat/pull/6688) Convert Oembed Package to Js
- [#6672](https://github.com/RocketChat/Rocket.Chat/pull/6672) Converted rocketchat-lib 3
- [#6654](https://github.com/RocketChat/Rocket.Chat/pull/6654) disable proxy configuration
@@ -168,7 +174,7 @@
- [#6780](https://github.com/RocketChat/Rocket.Chat/pull/6780) Convert Mailer Package to Js
- [#6694](https://github.com/RocketChat/Rocket.Chat/pull/6694) Convert markdown to js
- [#6689](https://github.com/RocketChat/Rocket.Chat/pull/6689) Convert Mentions-Flextab Package to Js
-- [#6781](https://github.com/RocketChat/Rocket.Chat/pull/6781) Convert Message-Star Package to js
+- [#6781](https://github.com/RocketChat/Rocket.Chat/pull/6781) Convert Message-Star Package to js
- [#6688](https://github.com/RocketChat/Rocket.Chat/pull/6688) Convert Oembed Package to Js
- [#6672](https://github.com/RocketChat/Rocket.Chat/pull/6672) Converted rocketchat-lib 3
- [#6654](https://github.com/RocketChat/Rocket.Chat/pull/6654) disable proxy configuration
diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json
index a448a26187d3..036fdf20deaa 100644
--- a/packages/rocketchat-i18n/i18n/en.i18n.json
+++ b/packages/rocketchat-i18n/i18n/en.i18n.json
@@ -753,7 +753,9 @@
"Integrations_for_all_channels": "Enter all_public_channels to listen on all public channels, all_private_groups to listen on all private groups, and all_direct_messages to listen to all direct messages.",
"InternalHubot": "Internal Hubot",
"InternalHubot_ScriptsToLoad": "Scripts to load",
- "InternalHubot_ScriptsToLoad_Description": "Please enter a comma separated list of scripts to load from https://github.com/github/hubot-scripts/tree/master/src/scripts",
+ "InternalHubot_ScriptsToLoad_Description": "Please enter a comma separated list of scripts to load from your custom folder",
+ "InternalHubot_PathToLoadCustomScripts": "Folder to load the scripts",
+ "InternalHubot_reload": "Reload the scripts",
"InternalHubot_Username_Description": "This must be a valid username of a bot registered on your server.",
"Invalid_confirm_pass": "The password confirmation does not match password",
"Invalid_email": "The email entered is invalid",
@@ -1237,6 +1239,7 @@
"Registration_via_Admin": "Registration via Admin",
"Regular_Expressions": "Regular Expressions",
"Release": "Release",
+ "Reload": "Reload",
"Remove": "Remove",
"Remove_Admin": "Remove Admin",
"Remove_as_moderator": "Remove as moderator",
@@ -1724,4 +1727,4 @@
"your_message_optional": "your message (optional)",
"Your_password_is_wrong": "Your password is wrong!",
"Your_push_was_sent_to_s_devices": "Your push was sent to %s devices"
-}
\ No newline at end of file
+}
diff --git a/packages/rocketchat-internal-hubot/hubot.coffee b/packages/rocketchat-internal-hubot/hubot.coffee
deleted file mode 100644
index b3c2b657ffbc..000000000000
--- a/packages/rocketchat-internal-hubot/hubot.coffee
+++ /dev/null
@@ -1,208 +0,0 @@
-CoffeeScript = Npm.require('coffee-script')
-CoffeeScript.register()
-
-Hubot = Npm.require('hubot')
-
-fs = Npm.require('fs')
-path = Npm.require('path')
-
-# Start a hubot, connected to our chat room.
-# 'use strict'
-
-# Log messages?
-DEBUG = false
-
-# Monkey-patch Hubot to support private messages
-Hubot.Response::priv = (strings...) ->
- @robot.adapter.priv @envelope, strings...
-
-# More monkey-patching
-Hubot.Robot::loadAdapter = -> # disable
-
-# grrrr, Meteor.bindEnvironment doesn't preserve `this` apparently
-bind = (f) ->
- g = Meteor.bindEnvironment (self, args...) -> f.apply(self, args)
- (args...) -> g @, args...
-
-class Robot extends Hubot.Robot
- constructor: (args...) ->
- super args...
- @hear = bind @hear
- @respond = bind @respond
- @enter = bind @enter
- @leave = bind @leave
- @topic = bind @topic
- @error = bind @error
- @catchAll = bind @catchAll
- @user = Meteor.users.findOne {username: @name}, fields: username: 1
- loadAdapter: -> false
- hear: (regex, callback) -> super regex, Meteor.bindEnvironment callback
- respond: (regex, callback) -> super regex, Meteor.bindEnvironment callback
- enter: (callback) -> super Meteor.bindEnvironment(callback)
- leave: (callback) -> super Meteor.bindEnvironment(callback)
- topic: (callback) -> super Meteor.bindEnvironment(callback)
- error: (callback) -> super Meteor.bindEnvironment(callback)
- catchAll: (callback) -> super Meteor.bindEnvironment(callback)
-
-class RocketChatAdapter extends Hubot.Adapter
- # Public: Raw method for sending data back to the chat source. Extend this.
- #
- # envelope - A Object with message, room and user details.
- # strings - One or more Strings for each message to send.
- #
- # Returns nothing.
- send: (envelope, strings...) ->
- console.log 'ROCKETCHATADAPTER -> send'.blue if DEBUG
- # console.log envelope, strings
- sendHelper @robot, envelope, strings, (string) =>
- console.log "send #{envelope.room}: #{string} (#{envelope.user.id})" if DEBUG
- RocketChat.sendMessage InternalHubot.user, { msg: string }, { _id: envelope.room }
-
- # Public: Raw method for sending emote data back to the chat source.
- #
- # envelope - A Object with message, room and user details.
- # strings - One or more Strings for each message to send.
- #
- # Returns nothing.
- emote: (envelope, strings...) ->
- console.log 'ROCKETCHATADAPTER -> emote'.blue if DEBUG
- sendHelper @robot, envelope, strings, (string) =>
- console.log "emote #{envelope.rid}: #{string} (#{envelope.u.username})" if DEBUG
- return @priv envelope, "*** #{string} ***" if envelope.message.private
- Meteor.call "sendMessage",
- msg: string
- rid: envelope.rid
- action: true
-
- # Priv: our extension -- send a PM to user
- priv: (envelope, strings...) ->
- console.log 'ROCKETCHATADAPTER -> priv'.blue if DEBUG
- sendHelper @robot, envelope, strings, (string) ->
- console.log "priv #{envelope.room}: #{string} (#{envelope.user.id})" if DEBUG
- Meteor.call "sendMessage",
- u:
- username: "rocketbot"
- to: "#{envelope.user.id}"
- msg: string
- rid: envelope.room
-
- # Public: Raw method for building a reply and sending it back to the chat
- # source. Extend this.
- #
- # envelope - A Object with message, room and user details.
- # strings - One or more Strings for each reply to send.
- #
- # Returns nothing.
- reply: (envelope, strings...) ->
- console.log 'ROCKETCHATADAPTER -> reply'.blue if DEBUG
- if envelope.message.private
- @priv envelope, strings...
- else
- @send envelope, strings.map((str) -> "#{envelope.user.name}: #{str}")...
-
- # Public: Raw method for setting a topic on the chat source. Extend this.
- #
- # envelope - A Object with message, room and user details.
- # strings - One more more Strings to set as the topic.
- #
- # Returns nothing.
- topic: (envelope, strings...) ->
- console.log 'ROCKETCHATADAPTER -> topic'.blue if DEBUG
-
- # Public: Raw method for playing a sound in the chat source. Extend this.
- #
- # envelope - A Object with message, room and user details.
- # strings - One or more strings for each play message to send.
- #
- # Returns nothing
- play: (envelope, strings...) ->
- console.log 'ROCKETCHATADAPTER -> play'.blue if DEBUG
-
- # Public: Raw method for invoking the bot to run. Extend this.
- #
- # Returns nothing.
- run: ->
- console.log 'ROCKETCHATADAPTER -> run'.blue if DEBUG
- @robot.emit 'connected'
- @robot.brain.mergeData {}
- # @robot.brain.emit 'loaded'
-
- # Public: Raw method for shutting the bot down. Extend this.
- #
- # Returns nothing.
- close: ->
- console.log 'ROCKETCHATADAPTER -> close'.blue if DEBUG
-
-class InternalHubotReceiver
- constructor: (message) ->
- console.log message if DEBUG
- if message.u.username isnt InternalHubot.name
- room = RocketChat.models.Rooms.findOneById message.rid
-
- if room.t is 'c'
- InternalHubotUser = new Hubot.User(message.u.username, room: message.rid)
- InternalHubotTextMessage = new Hubot.TextMessage(InternalHubotUser, message.msg, message._id)
- InternalHubot.adapter.receive InternalHubotTextMessage
- return message
-
-class HubotScripts
- constructor: (robot) ->
- modulesToLoad = [
- 'hubot-help/src/help.coffee'
- ]
-
- for modulePath in modulesToLoad
- try
- Npm.require(modulePath)(robot)
- robot.parseHelp __meteor_bootstrap__.serverDir+'/npm/node_modules/meteor/rocketchat_internal-hubot/node_modules/'+modulePath
- console.log "Loaded #{modulePath}".green
- catch e
- console.log "can't load #{modulePath}".red
- console.log e
-
- scriptsToLoad = RocketChat.settings.get('InternalHubot_ScriptsToLoad').split(',') or []
-
- for scriptFile in scriptsToLoad
- try
- scriptFile = s.trim(scriptFile)
-
- Npm.require('hubot-scripts/src/scripts/'+scriptFile)(robot)
- # robot.loadFile __meteor_bootstrap__.serverDir+'/npm/node_modules/meteor/rocketchat_internal-hubot/node_modules/hubot-scripts/src/scripts', scriptFile
- robot.parseHelp __meteor_bootstrap__.serverDir+'/npm/node_modules/meteor/rocketchat_internal-hubot/node_modules/hubot-scripts/src/scripts/'+scriptFile
- console.log "Loaded #{scriptFile}".green
- catch e
- console.log "can't load #{scriptFile}".red
- console.log e
-
-sendHelper = Meteor.bindEnvironment (robot, envelope, strings, map) ->
- while strings.length > 0
- string = strings.shift()
- if typeof(string) == 'function'
- string()
- else
- try
- map(string)
- catch err
- console.error "Hubot error: #{err}" if DEBUG
- robot.logger.error "RocketChat send error: #{err}"
-
-InternalHubot = {}
-
-init = _.debounce Meteor.bindEnvironment( =>
- if RocketChat.settings.get 'InternalHubot_Enabled'
- InternalHubot = new Robot null, null, false, RocketChat.settings.get 'InternalHubot_Username'
- InternalHubot.alias = 'bot'
- InternalHubot.adapter = new RocketChatAdapter InternalHubot
- HubotScripts(InternalHubot)
- InternalHubot.run()
- RocketChat.callbacks.add 'afterSaveMessage', InternalHubotReceiver, RocketChat.callbacks.priority.LOW, 'InternalHubot'
- else
- InternalHubot = {}
- RocketChat.callbacks.remove 'afterSaveMessage', 'InternalHubot'
-), 1000
-
-Meteor.startup ->
- init()
- RocketChat.models.Settings.findByIds([ 'InternalHubot_Username', 'InternalHubot_Enabled', 'InternalHubot_ScriptsToLoad']).observe
- changed: ->
- init()
diff --git a/packages/rocketchat-internal-hubot/hubot.js b/packages/rocketchat-internal-hubot/hubot.js
new file mode 100644
index 000000000000..102222b015fc
--- /dev/null
+++ b/packages/rocketchat-internal-hubot/hubot.js
@@ -0,0 +1,247 @@
+/* globals __meteor_bootstrap__ */
+const CoffeeScript = Npm.require('coffee-script');
+CoffeeScript.register();
+const Hubot = Npm.require('hubot');
+// Start a hubot, connected to our chat room.
+// 'use strict'
+// Log messages?
+const DEBUG = false;
+
+let InternalHubot = {};
+
+const sendHelper = Meteor.bindEnvironment((robot, envelope, strings, map) =>{
+ while (strings.length > 0) {
+ const string = strings.shift();
+ if (typeof(string) === 'function') {
+ string();
+ } else {
+ try {
+ map(string);
+ } catch (err) {
+ if (DEBUG) { console.error(`Hubot error: ${ err }`); }
+ robot.logger.error(`RocketChat send error: ${ err }`);
+ }
+ }
+ }
+});
+
+// Monkey-patch Hubot to support private messages
+Hubot.Response.prototype.priv = (...strings) => this.robot.adapter.priv(this.envelope, ...strings);
+
+// More monkey-patching
+Hubot.Robot.prototype.loadAdapter = () => {}; // disable
+
+// grrrr, Meteor.bindEnvironment doesn't preserve `this` apparently
+const bind = function(f) {
+ const g = Meteor.bindEnvironment((self, ...args) => f.apply(self, args));
+ return function(...args) { return g(this, ...Array.from(args)); };
+};
+
+class Robot extends Hubot.Robot {
+ constructor(...args) {
+ super(...(args || []));
+ this.hear = bind(this.hear);
+ this.respond = bind(this.respond);
+ this.enter = bind(this.enter);
+ this.leave = bind(this.leave);
+ this.topic = bind(this.topic);
+ this.error = bind(this.error);
+ this.catchAll = bind(this.catchAll);
+ this.user = Meteor.users.findOne({username: this.name}, {fields: {username: 1}});
+ }
+ loadAdapter() { return false; }
+ hear(regex, callback) { return super.hear(regex, Meteor.bindEnvironment(callback)); }
+ respond(regex, callback) { return super.respond(regex, Meteor.bindEnvironment(callback)); }
+ enter(callback) { return super.enter(Meteor.bindEnvironment(callback)); }
+ leave(callback) { return super.leave(Meteor.bindEnvironment(callback)); }
+ topic(callback) { return super.topic(Meteor.bindEnvironment(callback)); }
+ error(callback) { return super.error(Meteor.bindEnvironment(callback)); }
+ catchAll(callback) { return super.catchAll(Meteor.bindEnvironment(callback)); }
+}
+
+class RocketChatAdapter extends Hubot.Adapter {
+ // Public: Raw method for sending data back to the chat source. Extend this.
+ //
+ // envelope - A Object with message, room and user details.
+ // strings - One or more Strings for each message to send.
+ //
+ // Returns nothing.
+ send(envelope, ...strings) {
+ if (DEBUG) { console.log('ROCKETCHATADAPTER -> send'.blue); }
+ // console.log envelope, strings
+ return sendHelper(this.robot, envelope, strings, string => {
+ if (DEBUG) { console.log(`send ${ envelope.room }: ${ string } (${ envelope.user.id })`); }
+ return RocketChat.sendMessage(InternalHubot.user, { msg: string }, { _id: envelope.room });
+ });
+ }
+
+ // Public: Raw method for sending emote data back to the chat source.
+ //
+ // envelope - A Object with message, room and user details.
+ // strings - One or more Strings for each message to send.
+ //
+ // Returns nothing.
+ emote(envelope, ...strings) {
+ if (DEBUG) { console.log('ROCKETCHATADAPTER -> emote'.blue); }
+ return sendHelper(this.robot, envelope, strings, string => {
+ if (DEBUG) { console.log(`emote ${ envelope.rid }: ${ string } (${ envelope.u.username })`); }
+ if (envelope.message.private) { return this.priv(envelope, `*** ${ string } ***`); }
+ return Meteor.call('sendMessage', {
+ msg: string,
+ rid: envelope.rid,
+ action: true
+ }
+ );
+ });
+ }
+
+ // Priv: our extension -- send a PM to user
+ priv(envelope, ...strings) {
+ if (DEBUG) { console.log('ROCKETCHATADAPTER -> priv'.blue); }
+ return sendHelper(this.robot, envelope, strings, function(string) {
+ if (DEBUG) { console.log(`priv ${ envelope.room }: ${ string } (${ envelope.user.id })`); }
+ return Meteor.call('sendMessage', {
+ u: {
+ username: 'rocketbot'
+ },
+ to: `${ envelope.user.id }`,
+ msg: string,
+ rid: envelope.room
+ });
+ });
+ }
+
+ // Public: Raw method for building a reply and sending it back to the chat
+ // source. Extend this.
+ //
+ // envelope - A Object with message, room and user details.
+ // strings - One or more Strings for each reply to send.
+ //
+ // Returns nothing.
+ reply(envelope, ...strings) {
+ if (DEBUG) { console.log('ROCKETCHATADAPTER -> reply'.blue); }
+ if (envelope.message.private) {
+ return this.priv(envelope, ...strings);
+ } else {
+ return this.send(envelope, ...strings.map(str => `${ envelope.user.name }: ${ str }`));
+ }
+ }
+
+ // Public: Raw method for setting a topic on the chat source. Extend this.
+ //
+ // envelope - A Object with message, room and user details.
+ // strings - One more more Strings to set as the topic.
+ //
+ // Returns nothing.
+ topic(/*envelope, ...strings*/) {
+ if (DEBUG) { return console.log('ROCKETCHATADAPTER -> topic'.blue); }
+ }
+
+ // Public: Raw method for playing a sound in the chat source. Extend this.
+ //
+ // envelope - A Object with message, room and user details.
+ // strings - One or more strings for each play message to send.
+ //
+ // Returns nothing
+ play(/*envelope, ...strings*/) {
+ if (DEBUG) { return console.log('ROCKETCHATADAPTER -> play'.blue); }
+ }
+
+ // Public: Raw method for invoking the bot to run. Extend this.
+ //
+ // Returns nothing.
+ run() {
+ if (DEBUG) { console.log('ROCKETCHATADAPTER -> run'.blue); }
+ this.robot.emit('connected');
+ return this.robot.brain.mergeData({});
+ }
+ // @robot.brain.emit 'loaded'
+
+ // Public: Raw method for shutting the bot down. Extend this.
+ //
+ // Returns nothing.
+ close() {
+ if (DEBUG) { return console.log('ROCKETCHATADAPTER -> close'.blue); }
+ }
+}
+
+const InternalHubotReceiver = (message) => {
+ if (DEBUG) { console.log(message); }
+ if (message.u.username !== InternalHubot.name) {
+ const room = RocketChat.models.Rooms.findOneById(message.rid);
+
+ if (room.t === 'c') {
+ const InternalHubotUser = new Hubot.User(message.u.username, {room: message.rid});
+ const InternalHubotTextMessage = new Hubot.TextMessage(InternalHubotUser, message.msg, message._id);
+ InternalHubot.adapter.receive(InternalHubotTextMessage);
+ }
+ }
+ return message;
+};
+
+class HubotScripts {
+ constructor(robot) {
+ const modulesToLoad = [
+ 'hubot-help/src/help.coffee'
+ ];
+ const customPath = RocketChat.settings.get('InternalHubot_PathToLoadCustomScripts');
+ HubotScripts.load(`${ __meteor_bootstrap__.serverDir }/npm/node_modules/meteor/rocketchat_internal-hubot/node_modules/`, modulesToLoad, robot);
+ HubotScripts.load(customPath, RocketChat.settings.get('InternalHubot_ScriptsToLoad').split(',') || [], robot);
+ }
+
+ static load(path, scriptsToLoad, robot) {
+ if (!path || !scriptsToLoad) {
+ return;
+ }
+ scriptsToLoad.forEach(scriptFile => {
+ try {
+ scriptFile = s.trim(scriptFile);
+ if (scriptFile === '') {
+ return;
+ }
+ // delete require.cache[require.resolve(path+scriptFile)];
+ const fn = Npm.require(path + scriptFile);
+ if (typeof(fn) === 'function') {
+ fn(robot);
+ } else {
+ fn.default(robot);
+ }
+ robot.parseHelp(path + scriptFile);
+ console.log(`Loaded ${ scriptFile }`.green);
+ } catch (e) {
+ console.log(`Can't load ${ scriptFile }`.red);
+ console.log(e);
+ }
+ });
+ }
+}
+
+const init = _.debounce(Meteor.bindEnvironment(() => {
+ if (RocketChat.settings.get('InternalHubot_Enabled')) {
+ InternalHubot = new Robot(null, null, false, RocketChat.settings.get('InternalHubot_Username'));
+ InternalHubot.alias = 'bot';
+ InternalHubot.adapter = new RocketChatAdapter(InternalHubot);
+ new HubotScripts(InternalHubot);
+ InternalHubot.run();
+ return RocketChat.callbacks.add('afterSaveMessage', InternalHubotReceiver, RocketChat.callbacks.priority.LOW, 'InternalHubot');
+ } else {
+ InternalHubot = {};
+ return RocketChat.callbacks.remove('afterSaveMessage', 'InternalHubot');
+ }
+}), 1000);
+
+Meteor.startup(function() {
+ init();
+ RocketChat.models.Settings.findByIds([ 'InternalHubot_Username', 'InternalHubot_Enabled', 'InternalHubot_ScriptsToLoad', 'InternalHubot_PathToLoadCustomScripts']).observe({
+ changed() {
+ return init();
+ }
+ });
+ // TODO useful when we have the ability to invalidate `require` cache
+ // RocketChat.RateLimiter.limitMethod('reloadInternalHubot', 1, 5000, {
+ // userId(/*userId*/) { return true; }
+ // });
+ // Meteor.methods({
+ // reloadInternalHubot: () => init()
+ // });
+});
diff --git a/packages/rocketchat-internal-hubot/package.js b/packages/rocketchat-internal-hubot/package.js
index facdc64f4ba3..4d1295ee2072 100644
--- a/packages/rocketchat-internal-hubot/package.js
+++ b/packages/rocketchat-internal-hubot/package.js
@@ -8,7 +8,6 @@ Package.describe({
Package.onUse(function(api) {
api.use([
'ecmascript',
- 'coffeescript',
'underscore',
'tracker',
'rocketchat:lib'
@@ -18,8 +17,8 @@ Package.onUse(function(api) {
api.use('templating', 'client');
api.addFiles([
- 'hubot.coffee',
- 'settings.coffee'
+ 'hubot.js',
+ 'settings.js'
], ['server']);
api.export('Hubot', ['server']);
@@ -33,6 +32,5 @@ Package.onUse(function(api) {
Npm.depends({
'coffee-script': '1.10.0',
'hubot': '2.19.0',
- 'hubot-scripts': '2.17.1',
'hubot-help': '0.2.0'
});
diff --git a/packages/rocketchat-internal-hubot/scripts/maps.coffee b/packages/rocketchat-internal-hubot/scripts/maps.coffee
deleted file mode 100644
index ed22ec1e40d2..000000000000
--- a/packages/rocketchat-internal-hubot/scripts/maps.coffee
+++ /dev/null
@@ -1,25 +0,0 @@
-# Description:
-# Interacts with the Google Maps API.
-#
-# Commands:
-# hubot map me - Returns a map view of the area returned by `query`.
-
-module.exports = (robot) ->
-
- robot.respond /(?:(satellite|terrain|hybrid)[- ])?map me (.+)/i, (msg) ->
- mapType = msg.match[1] or "roadmap"
- location = msg.match[2]
- mapUrl = "http://maps.google.com/maps/api/staticmap?markers=" +
- escape(location) +
- "&size=400x400&maptype=" +
- mapType +
- "&sensor=false" +
- "&format=png" # So campfire knows it's an image
- url = "http://maps.google.com/maps?q=" +
- escape(location) +
- "&hl=en&sll=37.0625,-95.677068&sspn=73.579623,100.371094&vpsrc=0&hnear=" +
- escape(location) +
- "&t=m&z=11"
-
- msg.send mapUrl
- msg.send url
diff --git a/packages/rocketchat-internal-hubot/scripts/pugme.coffee b/packages/rocketchat-internal-hubot/scripts/pugme.coffee
deleted file mode 100644
index 1bc4b8f95c92..000000000000
--- a/packages/rocketchat-internal-hubot/scripts/pugme.coffee
+++ /dev/null
@@ -1,31 +0,0 @@
-# Description:
-# Pugme is the most important thing in life
-#
-# Dependencies:
-# None
-#
-# Configuration:
-# None
-#
-# Commands:
-# hubot pug me - Receive a pug
-# hubot pug bomb N - get N pugs
-
-module.exports = (robot) ->
-
- robot.respond /pug me/i, (msg) ->
- msg.http("http://pugme.herokuapp.com/random")
- .get() (err, res, body) ->
- msg.send JSON.parse(body).pug
-
- robot.respond /pug bomb( (\d+))?/i, (msg) ->
- count = msg.match[2] || 5
- count = 5 if count > 5
- msg.http("http://pugme.herokuapp.com/bomb?count=" + count)
- .get() (err, res, body) ->
- msg.send pug for pug in JSON.parse(body).pugs
-
- robot.respond /how many pugs are there/i, (msg) ->
- msg.http("http://pugme.herokuapp.com/count")
- .get() (err, res, body) ->
- msg.send "There are #{JSON.parse(body).pug_count} pugs."
diff --git a/packages/rocketchat-internal-hubot/settings.coffee b/packages/rocketchat-internal-hubot/settings.coffee
deleted file mode 100644
index 52249d5dc418..000000000000
--- a/packages/rocketchat-internal-hubot/settings.coffee
+++ /dev/null
@@ -1,4 +0,0 @@
-RocketChat.settings.addGroup 'InternalHubot'
-RocketChat.settings.add 'InternalHubot_Enabled', false, { type: 'boolean', group: 'InternalHubot', i18nLabel: 'Enabled' }
-RocketChat.settings.add 'InternalHubot_Username', 'rocket.cat', { type: 'string', group: 'InternalHubot', i18nLabel: 'Username', i18nDescription: 'InternalHubot_Username_Description' }
-RocketChat.settings.add 'InternalHubot_ScriptsToLoad', 'hello.coffee,zen.coffee', { type: 'string', group: 'InternalHubot'}
diff --git a/packages/rocketchat-internal-hubot/settings.js b/packages/rocketchat-internal-hubot/settings.js
new file mode 100644
index 000000000000..ae9b334ca0e8
--- /dev/null
+++ b/packages/rocketchat-internal-hubot/settings.js
@@ -0,0 +1,10 @@
+RocketChat.settings.addGroup('InternalHubot', function() {
+ this.add('InternalHubot_Enabled', false, { type: 'boolean', i18nLabel: 'Enabled' });
+ this.add('InternalHubot_Username', 'rocket.cat', { type: 'string', i18nLabel: 'Username', i18nDescription: 'InternalHubot_Username_Description' });
+ this.add('InternalHubot_ScriptsToLoad', '', { type: 'string'});
+ this.add('InternalHubot_PathToLoadCustomScripts', '', { type: 'string' });
+ // this.add('InternalHubot_reload', 'reloadInternalHubot', {
+ // type: 'action',
+ // actionText: 'reload'
+ // });
+});
diff --git a/server/startup/migrations/v096.js b/server/startup/migrations/v096.js
new file mode 100644
index 000000000000..4e15e42189fa
--- /dev/null
+++ b/server/startup/migrations/v096.js
@@ -0,0 +1,8 @@
+RocketChat.Migrations.add({
+ version: 96,
+ up() {
+ if (RocketChat && RocketChat.models && RocketChat.models.Settings) {
+ RocketChat.models.Settings.update({ _id: 'InternalHubot_ScriptsToLoad' }, { $set: { value: '' } });
+ }
+ }
+});