Skip to content

Conversation

@smiile8888
Copy link
Owner

  • command supports to create the channel webhook

- add command support to create webhook
- add function to create webhook and interact back to author of message
- update name of the app
@smiile8888 smiile8888 self-assigned this Jul 24, 2020
const dotenv = require('dotenv');
const movie = require('./modules/movie-fetch.js');

dotenv.config();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do not we need it?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I import the config via command line so that we don't have to clean up the code when we deploy on to Heroku.

}).catch(() => { msg.reply("Movie not found!"); });
}

if (cmd.startsWith(cli.WEBHOOK)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the pros using startsWith over ===

Copy link
Owner Author

Choose a reason for hiding this comment

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

Because it receives the arguments passed by the message (i.e., webhook name and avatar image URL) but has to start with /createHook

Copy link
Collaborator

Choose a reason for hiding this comment

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

startsWith is misleading cuz cmd is already processed and has the same length as any cli you want to compare.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Owner Author

Choose a reason for hiding this comment

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

What would you suggest handling this?

let args = msg.content.split(" ").slice(1);
if (!args.length) {
return msg.reply("Give me bot name and avatar image (optional)!");
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not work on processMsg? ==> we should separate the work?

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