-
Notifications
You must be signed in to change notification settings - Fork 0
Add support for bot to create webhook from message #3
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
base: master
Are you sure you want to change the base?
Conversation
smiile8888
commented
Jul 24, 2020
- 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
| const dotenv = require('dotenv'); | ||
| const movie = require('./modules/movie-fetch.js'); | ||
|
|
||
| dotenv.config(); |
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.
Do not we need it?
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.
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)) { |
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.
What is the pros using startsWith over ===
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.
Because it receives the arguments passed by the message (i.e., webhook name and avatar image URL) but has to start with /createHook
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.
startsWith is misleading cuz cmd is already processed and has the same length as any cli you want to compare.
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.
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.
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)!"); | ||
| } |
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.
Why not work on processMsg? ==> we should separate the work?