Skip to content

Commit

Permalink
translations for hubot scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed May 25, 2017
1 parent 7709604 commit 3a67bf9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
7 changes: 5 additions & 2 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,9 @@
"Integrations_for_all_channels": "Enter <strong>all_public_channels</strong> to listen on all public channels, <strong>all_private_groups</strong> to listen on all private groups, and <strong>all_direct_messages</strong> 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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
}
48 changes: 23 additions & 25 deletions packages/rocketchat-internal-hubot/hubot.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
CoffeeScript = Npm.require('coffee-script');
/* eslint-disable no-use-before-define no-unused-vars */
/* globals __meteor_bootstrap__ */
const CoffeeScript = Npm.require('coffee-script');
CoffeeScript.register();
const Hubot = Npm.require('hubot');
import fs from 'fs';
import path from 'path';

// 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);

Expand Down Expand Up @@ -118,7 +135,7 @@ class RocketChatAdapter extends Hubot.Adapter {
// strings - One more more Strings to set as the topic.
//
// Returns nothing.
topic(envelope, ...strings) {
topic(/*envelope, ...strings*/) {
if (DEBUG) { return console.log('ROCKETCHATADAPTER -> topic'.blue); }
}

Expand All @@ -128,7 +145,7 @@ class RocketChatAdapter extends Hubot.Adapter {
// strings - One or more strings for each play message to send.
//
// Returns nothing
play(envelope, ...strings) {
play(/*envelope, ...strings*/) {
if (DEBUG) { return console.log('ROCKETCHATADAPTER -> play'.blue); }
}

Expand Down Expand Up @@ -195,25 +212,6 @@ class HubotScripts {
}
}


var 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 }`);
}
}
}
});

var InternalHubot = {};

const init = _.debounce(Meteor.bindEnvironment(() => {
if (RocketChat.settings.get('InternalHubot_Enabled')) {
InternalHubot = new Robot(null, null, false, RocketChat.settings.get('InternalHubot_Username'));
Expand Down

0 comments on commit 3a67bf9

Please sign in to comment.