Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- bot.js ----------------------------------------------------------------
- file: bot.js
- const mycommands = require("./mycommands.js");
- function main() {
- console.log("bot started")
- // imagine here the main bot loop, which reads and evals all chat messages
- // if chat messages contains greet ...
- mycommands.greet("ku");
- // if chat messages contains hi ...
- mycommands.hi("Salve")
- }
- main()
- --- mycommands.js ----------------------------------------------------------
- file: mycommands.js
- function hi(text) {
- console.log(text);
- }
- function greetings(name) {
- return `Hello, ${name}`;
- }
- module.exports = { greetings, hi };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement