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

Added phrase return to @gaming_bot #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Added phrase return to @gaming_bot #1

wants to merge 1 commit into from

Conversation

lukeask
Copy link

@lukeask lukeask commented Feb 25, 2021

untested

@@ -122,11 +122,20 @@ const deregisterHandler = async (client, msg) => {
}
};

const chatHandler = (client, text) => {
fs.readFile(../chatbot/phraselist.txt, function(err, data){
Copy link
Owner

Choose a reason for hiding this comment

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

File path is not in a string. This will break

@@ -122,11 +122,20 @@ const deregisterHandler = async (client, msg) => {
}
};

const chatHandler = (client, text) => {
fs.readFile(../chatbot/phraselist.txt, function(err, data){
Copy link
Owner

Choose a reason for hiding this comment

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

IF I EVER SEE ANOTHER ANONYMOUS FUNCTION THAT ISN'T AN ARROW FUNCTION YOU ARE BANNED

Copy link
Owner

Choose a reason for hiding this comment

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

const handlerMap = {
".help": helpHandler,
".register": registerHandler,
".deregister": deregisterHandler,
".recognized-command": crawlRequestHandler,
"@gaming_bot": chatHandler,
Copy link
Owner

Choose a reason for hiding this comment

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

Overall, I'd prefer all commands that the gamingbot recognizes to begin with the same special character, for continuity.

@@ -122,11 +122,20 @@ const deregisterHandler = async (client, msg) => {
}
};

const chatHandler = (client, text) => {
fs.readFile(../chatbot/phraselist.txt, function(err, data){
var lines = data.split('\n');
Copy link
Owner

Choose a reason for hiding this comment

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

There are lots of issues with using the keyword var. Use let for variables you will reassign (in the manner of let lines; lines = somethingNew;. Use const for variables you do not plan to reassign.

Copy link
Owner

Choose a reason for hiding this comment

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

mass murder of gamers
execute a gamer save a life
make gaming a felony
An amateur programmer that will steal your code and call it his own
Copy link
Owner

Choose a reason for hiding this comment

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

What is the difference between phraselist and phraselist.txt? Only one is probably needed?

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.

2 participants