This repository has been archived by the owner on Oct 20, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 59
Fix/thanks #78
Merged
Merged
Fix/thanks #78
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
94e2558
fix thanks @/all and thanks regex
throwarray ce624ac
love you @camperbot
throwarray 7bbf0ae
cookie emoji instead of star for 'about'
throwarray 0abb5d0
fix thanks regexp
throwarray f263d8b
fix love
throwarray 6ba0383
remove botx
throwarray b1d9b5f
Fixes missing messages command
throwarray 1933246
remove dead message code
throwarray 2e431ed
undo changes to thanks.js
throwarray 7f3e313
use non-capture groups
throwarray 74f468f
lookahead to ignore thanks in usernames
throwarray 54c3e6e
drop the lookahead
throwarray 6f3e744
ignore love in usernames
throwarray f725e47
superstar
throwarray File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @noncentz please write a documentation in a comment about the command i.e. what it does and when it does, etc. /**
* This command loves camperbot.
**/ |
||
const fromUser = '@' + input.message.model.fromUser.username; | ||
return fromUser + ', :sparkles: :heart_eyes: :sparkles:'; | ||
} | ||
} | ||
]; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
// 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); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This regex seems perfect. 👍