Skip to content
This repository has been archived by the owner on Oct 20, 2018. It is now read-only.

[DON'T-MERGE] Minor cleanups #163

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ developed to integrate with the chat rooms for

### Github Wiki Search

You can search for articles in a projects github wiki
You can search for articles in a project's GitHub wiki
![](https://freecodecamp.github.io/camperbot/images/anims/find.gif)

### Share wiki summaries in chat
### Share Wiki summaries in chat

Use `explain` to pull a wiki summary right into the chat:
![](https://freecodecamp.github.io/camperbot/images/anims/explain.gif)
Expand Down Expand Up @@ -164,7 +164,7 @@ You can either

Follow the instructions for signing up on [https://github.com/](GitHub)

change the `SERVER_ENV=demobot` in your `.env` to `server_ENV=USERNAMEHERE`
Change the `SERVER_ENV=demobot` in your `.env` to `server_ENV=USERNAMEHERE`
where *USERNAMEHERE* is your github user name.

### Getting your own appID
Expand All @@ -182,10 +182,10 @@ The next page should show you various API keys/secrets. Use those to replace
the demobot default options in your `.env`.

### Configure your bot
Now it is time to set up your bot w/ the app.
Now it is time to set up your bot with the app.
Copy `example.config.json` to `config.json` and open `config.json` in your
editor.
Replace all instances of GITHUB_USER_ID with your user name
Replace all instances of GITHUB_USER_ID with your username
set up earlier.

Take note of the the rooms property of config. You can set up additional gitter rooms
Expand Down Expand Up @@ -284,7 +284,7 @@ where `input.keyword` is `thanks` then

`BotCommands[input.keyword]` is like saying `BotCommands.thanks()`

so then the params get also added in `(input, this)` so its
so then the params get also added in `(input, this)` so it's

```js
BotCommands[input.keyword](input, this);
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/HttpWrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const HttpWrap = {
};

const request = https.request(this.defaultOptions, handleResponse);
request.setTimeout(3000, handleTimeout);
request.setTimeout(5000, handleTimeout);
request.end();
}
};
Expand Down
8 changes: 3 additions & 5 deletions lib/utils/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,9 @@ const Utils = {
return out;
},

timeStamp: function(when, baseDate) {
timeStamp: function(when, baseDate = new Date()) {
let month;
let day;
baseDate = baseDate || new Date();
const d1 = new Date();

switch (when) {
Expand All @@ -225,11 +224,10 @@ const Utils = {
return timestamp;
},

hasProperty: function(obj, prop, msg) {
hasProperty: function(obj, prop, msg = 'ERROR') {
if (obj && obj.hasOwnProperty(prop)) {
return true;
}
msg = msg || 'ERROR';
Utils.error(msg);
Utils.error('missing property', prop, obj);
return false;
Expand All @@ -244,4 +242,4 @@ const Utils = {

Utils.logLevel = parseInt(process.env.LOG_LEVEL || 4, 10);

module.exports = Utils;
module.exports = Utils;