Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NewXKitBot 2.0 #4

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

NewXKitBot 2.0 #4

wants to merge 8 commits into from

Conversation

Wolvan
Copy link
Member

@Wolvan Wolvan commented Nov 20, 2015

I decided to do a full rewrite of the bot, in turn cleaning it up and making it easier to use and to configure

### What is New-XKit Bot?
New-XKit Bot is the team behind [New XKit](https://github.com/new-xkit/XKit)'s helping little assistant, written in JavaScript for [Node.js](https://nodejs.org/). It's here to make the lives of the New-XKit team just a tiny bit easier!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be misread as "(New-XKit Bot is the team behind New XKit)'s helping little assistant" rather than "New-XKit Bot is (the team behind New XKit)'s helping little assistant". For clarity, I would rewrite this as

New-XKit Bot is New XKit team's little assistant

@Wolvan Wolvan force-pushed the rewrite_1 branch 2 times, most recently from 3a06d01 to 3598bab Compare November 20, 2015 03:12
@Wolvan
Copy link
Member Author

Wolvan commented Nov 20, 2015

Made your changes top the README.md, @bvtsang

@Wolvan Wolvan added this to the 2.0.0 milestone Nov 20, 2015
1. Install [Node.js](https://nodejs.org/)
2. Clone this repository into a folder
3. Copy the ``default.js`` file in the ``config`` subfolder and rename it to ``local.js``
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub's Markdown Basics document recommends using single backticks (`).

@0xazure
Copy link

0xazure commented Nov 20, 2015

The lack of in-line documentation makes things a little tricky to understand what's going on, particularly in the cases where RegEx is being used to transform the messages.

I would also still like to see thorough documentation as to how the NewXKit bot is set up and run on our infrastructure. It doesn't necessarily need to be a part of this project, but formal deployment instructions would be helpful.

Generally, having monolithic do-everything files make it more difficult to reason about a project. Splitting the code up by concerns and making things more modular would go a long way to help readability and understanding.

These have just been my initial thoughts and comments, and do not constitute a formal code review.

@@ -1,3 +1,24 @@
# NewXKitBot
# New-XKit Bot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we standardized on New XKit in prose and new-xkit in code, fyi.

@nightpool
Copy link
Member

would be nice to have this linted

@0xazure
Copy link

0xazure commented Nov 20, 2015

would be nice to have this linted

I'd probably recommend XO for a Just Works ™️ linter, if we don't want to fuss with config options, otherwise ESLint.

Since this is a rewrite from scratch, clear out everything and restore a
clean workspace
After clearing out the old code, re-init the repository with a proper
README.md, a LICENSE.md (GPL-2.0) and a .gitignore for NodeJS projects
} else {
command.not_allowed(user, gitter, irc);
}
}.bind(this, from, args, command_data));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary bind.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, that bind is necessary iirc. Since I am doing an async call here and I have 2 async calls collide it can lead to issues. I had that before

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as long as you don't use this in your anonymous functions, you don't need to use bind. Also, remove the (user, args, command) parameters from the argument list, they're in the closure context of the function

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have from, and args and command_data I use though. The loop progresses, overwriting those variables, so when a callback gets called it messes up. See Screenshot
image
This happened to me before doing the bind

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, but from, args and command_data don't change—they're static to the anonymous function context that's generated on line 96

These 2 clients are wrappers for the bigger node-irc and node-gitter
modules that do most of the heavy lifting. Since only a few events and
functions are needed from each, these 2 wrapper modules gives convenient
access to them and make opening a connection easy.
This module combines the GitterChat and the IRCChat module to create a
functional bridge between these 2 services. Each GitterIRCBridge
represents a single pair of IRC and Gitter Channel.
Should be self-explanatory, write a default configuration file
which can be extended through a local.js.
This is the bot's core to bootstrap it. Config loading and, for now,
GitterIRCBridge-initializing are done from this core file
Run "npm init" to create the package.json for easy bot installation and
meta-data
Put the license information in each source file the way GPL-2.0 says
and remove the "How to apply this license" part from LICENSE.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants