Advertisement
neunmalelf

Untitled

Sep 23rd, 2023
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. --- bot.js ----------------------------------------------------------------
  2. file: bot.js
  3.  
  4. const mycommands = require("./mycommands.js");
  5.  
  6. function main() {
  7. console.log("bot started")
  8. // imagine here the main bot loop, which reads and evals all chat messages
  9.  
  10. // if chat messages contains greet ...
  11. mycommands.greet("ku");
  12.  
  13. // if chat messages contains hi ...
  14. mycommands.hi("Salve")
  15.  
  16. }
  17.  
  18. main()
  19.  
  20.  
  21. --- mycommands.js ----------------------------------------------------------
  22. file: mycommands.js
  23.  
  24. function hi(text) {
  25. console.log(text);
  26. }
  27.  
  28. function greetings(name) {
  29. return `Hello, ${name}`;
  30. }
  31.  
  32. module.exports = { greetings, hi };
  33.  
  34.  
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement