RE: Writing a Discord bot 03-05-2016, 03:50 AM
#2
For this case, winston is purely aesthetic, and something more lightweight like chalk could do the job of coloring text just as well (plus, asynchronicity isn't a requirement here). Some additions to this could be using an argument parser like argparse to specify bot activities, or give the user the capability to send messages.
I actually made something really similar a while back, check it out here.
Not that this was bad, but just some tips for writing tutorials in the future:
Furthermore, adding the following to package.json then running npm install . negates the need for pre-installing dependencies, as well as generates set executables and runs any defined scripts
Edit: seeing discord bots pop up again has convinced me to make a functional command parsing bot for discord, so stay tuned
I actually made something really similar a while back, check it out here.
Not that this was bad, but just some tips for writing tutorials in the future:
- don't spoonfeed readers by giving them the exact code. Instead of giving the command to install npm packages (can be shortened to just npm install socket.io winston), tell them to do that, but not how. Thus they need to teach themselves if they don't already know.
- Explain your code more thoroughly using comments or breaking it into smaller pieces, so readers know what's going on. Again, this is about helping them learn
Furthermore, adding the following to package.json then running npm install . negates the need for pre-installing dependencies, as well as generates set executables and runs any defined scripts
Code:
"dependencies": {
"socket.io": ">=1.4.5",
"winston": ">=2.2.0"
}
Edit: seeing discord bots pop up again has convinced me to make a functional command parsing bot for discord, so stay tuned
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.
don't have much in the first place, who feel the new currents and ride them the farthest.