first version of Help component
This commit is contained in:
parent
4f93adf525
commit
a084196c0e
|
@ -0,0 +1,35 @@
|
|||
const Help = (event) => {
|
||||
let msg = event.message;
|
||||
let cmd = msg.match(/^,help (\w+)?$/);
|
||||
|
||||
if (!cmd || !cmd[1]) {
|
||||
event.reply(",help commands - show all avalible commands");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (cmd[1]) {
|
||||
case "w":
|
||||
event.reply(",w [location] - show weather for you city");
|
||||
event.reply(",w set [location] - save your location");
|
||||
event.reply(",w - after your save your location you can use ,w");
|
||||
break;
|
||||
|
||||
case "commands":
|
||||
event.reply(",help [command] for details");
|
||||
event.reply("avalible commands: w");
|
||||
event.reply(" ,help w");
|
||||
break;
|
||||
|
||||
default:
|
||||
event.reply(",help - show this message");
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// let msg = ",help w";
|
||||
|
||||
// let cmd = msg.match(/^,help (\w+)?$/);
|
||||
|
||||
// console.log(cmd);
|
||||
|
||||
export default Help;
|
8
index.js
8
index.js
|
@ -1,7 +1,8 @@
|
|||
import { Client } from "irc-framework";
|
||||
import InitDB from "./components/db.js";
|
||||
import Weather from "./components/Weather.js";
|
||||
import UrlTitle from "./components/UrlTitle.js";
|
||||
import InitDB from "./components/db.js";
|
||||
import Help from "./components/Help.js";
|
||||
|
||||
InitDB();
|
||||
|
||||
|
@ -43,8 +44,5 @@ bot.matchMessage(/^,w/, async (event) => {
|
|||
});
|
||||
|
||||
bot.matchMessage(/^,help/, (event) => {
|
||||
event.reply(",help - show this message");
|
||||
event.reply(",w [location] - show weather for you city");
|
||||
event.reply(",w set [location] - save your location");
|
||||
event.reply(",w - after your save your location you can use ,w");
|
||||
return Help(event);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue