Skip to content
This repository has been archived by the owner. It is now read-only.

Fix/thanks #78

Merged
merged 14 commits into from May 1, 2016
@@ -129,7 +129,7 @@ git clone https://github.com/FreeCodeCamp/camperbot.git
- Run the following commands to run the app:

```sh
cd campberbot
cd camperbot
copy dot-EXAMPLE.env dot.env
git submodule update --remote --checkout --init --recursive
npm install
@@ -22,12 +22,6 @@ const AllRoomMessages = [
'(https://gitter.im/FreeCodeCamp/HelpBonfires)',
not: 'freecodecamp/HelpBonfires'
},

{
regex: /botx/i,
text: '> you called?'
},

{
regex: /\btroll\b/i,
text: '> :trollface: troll problems? [notify admins here]' +
@@ -50,8 +44,17 @@ const AllRoomMessages = [
chance: 1
},
{
regex: /\bth?a?n?[xk]s?q?\b/gim,
//tests: https://regex101.com/r/hH5cN7/42
regex: /(?:^|\s)(?:(?:th(?:n[qx]|x)|t[xyq])|than[kx](?:[sxz]){0,2}(?:[uq]|y(?:ou)?)?)\b/i,

This comment has been minimized.

Copy link
@abhisekp

abhisekp Apr 25, 2016

Member

This regex seems perfect. 👍

Pending Test

func: BotCommands.thanks
},
{
//tests: https://regex101.com/r/pT0zJ1/3
regex: /(?:^|\s)(?:love|luv)\s?(?:u|you|me)?,?\s?(?:cbot|@?camperbot)\b/i,
func: function(input) {
const fromUser = '@' + input.message.model.fromUser.username;
return fromUser + ', :sparkles: :heart_eyes: :sparkles:';
}
}
];

@@ -108,7 +108,7 @@ const GBot = {
listReplyOptionsAvailable = this.findListOption(input);
let output;

if (input.command) {
if (input.command && BotCommands.hasOwnProperty(input.keyword) && typeof BotCommands[input.keyword] === 'function') {
// this looks up a command and calls it
output = BotCommands[input.keyword](input, this);
} else if (listReplyOptionsAvailable !== false) {
@@ -6,15 +6,15 @@ const Utils = require('../../../lib/utils/Utils'),

const thanksCommands = {

messages: {
wikiHint: function(fromUser) {
const wikiUrl = '(https://github.com/freecodecamp/' +
'freecodecamp/wiki/wiki-style-guide)';

return '\n> hey @' + fromUser + ' if you found this info helpful ' +
':point_right: *[consider adding a wiki article!]' + wikiUrl + '*';
}
},
// messages: {

This comment has been minimized.

Copy link
@abhisekp

abhisekp Apr 25, 2016

Member

Pending: Test this in bonfire rooms

Pending Test

// wikiHint: function(fromUser) {
// const wikiUrl = '(https://github.com/freecodecamp/' +
// 'freecodecamp/wiki/wiki-style-guide)';
//
// return '\n> hey @' + fromUser + ' if you found this info helpful ' +
// ':point_right: *[consider adding a wiki article!]' + wikiUrl + '*';
// }
// },

thanks: function(input, bot) {
Utils.hasProperty(input, 'message', 'thanks expects an object');
@@ -105,8 +105,9 @@ const thanksCommands = {
try {
const username = blob.response.about.username,
about = blob.response.about,
brownieEmoji = about.browniePoints < 999 ? ':cookie:' : ':star2:',
uri = 'http://www.freecodecamp.com/' + username;
str = '> :star: ' + about.browniePoints + ' | @' + username + ' | ';
str = `> ${brownieEmoji} ${about.browniePoints} | @${username} |`;
str += TextLib.mdLink(uri, uri);
} catch (err) {
Utils.error('can\'t create response from API callback', err);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.