help system
This commit is contained in:
parent
61079e4000
commit
d209b2b54e
@ -56,6 +56,7 @@ read().then(() => {
|
||||
|
||||
function trigger(args) {
|
||||
this.call = args.call;
|
||||
this.help = args.help || false;
|
||||
this.level = args.level || 0;
|
||||
this.active = args.hasOwnProperty("active") ? args.active : true;
|
||||
this.clients = args.clients || ["irc", "tg"];
|
||||
|
@ -15,6 +15,10 @@ Object.keys(data).forEach(cur => {
|
||||
export default bot => {
|
||||
bot._trigger.set("dope", new bot.trigger({
|
||||
call: /^(\.|\/)dope/i,
|
||||
help: {
|
||||
text: "Smoke weed everyday",
|
||||
usage: "[b].dope[/b] [i](<nick>)[/i]"
|
||||
},
|
||||
f: e => {
|
||||
const strain_types = Object.keys(data.dope_strains);
|
||||
const action_types = Object.keys(data.dope_actions);
|
||||
@ -28,6 +32,10 @@ export default bot => {
|
||||
|
||||
bot._trigger.set("meth", new bot.trigger({
|
||||
call: /^(\.|\/)meth/i,
|
||||
help: {
|
||||
text: "Snort some meth *_*",
|
||||
usage: "[b].meth[/b] [i](<nick>)[/i]"
|
||||
},
|
||||
f: e => {
|
||||
e.replyAction(`legt [b]${e.args[0] || e.user.nick}[/b] eine dicke Line Meth \\________`);
|
||||
}
|
||||
|
19
src/inc/trigger/help.mjs
Normal file
19
src/inc/trigger/help.mjs
Normal file
@ -0,0 +1,19 @@
|
||||
export default bot => {
|
||||
bot._trigger.set("help", new bot.trigger({
|
||||
call: /^(\.|\/)help/i,
|
||||
f: e => {
|
||||
if(e.args[0] && [...bot._trigger.keys()].includes(e.args[0])) {
|
||||
const help = bot._trigger.get(e.args[0]).help;
|
||||
e.reply(help.text);
|
||||
e.reply(`usage: ${help.usage}`);
|
||||
}
|
||||
else {
|
||||
let triggers = [];
|
||||
[...bot._trigger.entries()]
|
||||
.filter(trigger => trigger[1].help)
|
||||
.forEach(trigger => triggers.push(trigger[0]));
|
||||
e.reply(`available commands: ${triggers.map(blah => `[b]${blah}[/b]`).join(", ")}`);
|
||||
}
|
||||
}
|
||||
}));
|
||||
};
|
@ -4,6 +4,7 @@ import cookie from "./cookie";
|
||||
import core from "./core";
|
||||
import debug from "./debug";
|
||||
import drugs from "./drugs";
|
||||
import help from "./help";
|
||||
import kernel from "./kernel";
|
||||
import mcmaniac from "./mcmaniac";
|
||||
import parser from "./parser";
|
||||
@ -17,7 +18,7 @@ import wttr from "./wttr";
|
||||
|
||||
export default [
|
||||
cfg, coins, cookie, core, debug,
|
||||
drugs, kernel, mcmaniac,
|
||||
drugs, help, kernel, mcmaniac,
|
||||
parser, quotes, rape, sandbox,
|
||||
urban, nxy, uwe, wttr
|
||||
];
|
@ -3,6 +3,10 @@ import sql from "../sql";
|
||||
export default bot => {
|
||||
bot._trigger.set("rape", new bot.trigger({
|
||||
call: /^(\.|\/)rape/i,
|
||||
help: {
|
||||
text: "Rapes a nick and eventually charge for it",
|
||||
usage: "[b].rape[/b] [i](<nick>)[/i]"
|
||||
},
|
||||
f: e => {
|
||||
const nick = e.args[0] || e.user.nick;
|
||||
const rand = Math.round(Math.random());
|
||||
@ -27,6 +31,10 @@ export default bot => {
|
||||
|
||||
bot._trigger.set("owe", new bot.trigger({
|
||||
call: /^(\.|\/)owe/i,
|
||||
help: {
|
||||
text: "Shows how much a nick owes",
|
||||
usage: "[b].owe[/b] [i](<nick>)[/i]"
|
||||
},
|
||||
f: e => {
|
||||
const nick = e.args[0] || e.user.nick;
|
||||
sql.any("select fines from nxy_users where lower(nick) = lower($1) limit 1", [nick])
|
||||
|
@ -5,6 +5,10 @@ const url = "https://api.urbandictionary.com/v0/define"
|
||||
export default bot => {
|
||||
bot._trigger.set("urbandict", new bot.trigger({
|
||||
call: /^(\.|\/)ud .*/i,
|
||||
help: {
|
||||
text: "Searches for a term on Urbandict and returns first result",
|
||||
usage: "[b].ud[/b] [i]<term>[/i] [i](<index>)[/i]"
|
||||
},
|
||||
f: e => {
|
||||
let index = 1;
|
||||
if(!isNaN(e.args[e.args.length - 1]) && e.args.length > 1)
|
||||
|
@ -23,6 +23,10 @@ Object.keys(data).forEach(cur => {
|
||||
export default bot => {
|
||||
bot._trigger.set("kiss", new bot.trigger({
|
||||
call: /^(\.|\/)kiss/i,
|
||||
help: {
|
||||
text: "Kisses a user",
|
||||
usage: "[b].kiss[/b] [i](<nick>)[/i]"
|
||||
},
|
||||
f: e => {
|
||||
e.reply(`(づ。◕‿‿◕。)づ" [color=red]。。・゜゜・。。・゜❤[/color] [b]${e.args[0] || e.user.nick}[/b] [color=red]❤[/color]`);
|
||||
}
|
||||
@ -30,6 +34,10 @@ export default bot => {
|
||||
|
||||
bot._trigger.set("hug", new bot.trigger({
|
||||
call: /^(\.|\/)hug/i,
|
||||
help: {
|
||||
text: "Hugs a user",
|
||||
usage: "[b].hug[/b] [i](<nick>)[/i]"
|
||||
},
|
||||
f: e => {
|
||||
e.reply(`[color=red]♡❤♡♥[/color] [b]${e.args[0] || e.user.nick}[/b] [color=red]♥♡❤♡♥[/color]`);
|
||||
}
|
||||
|
@ -3,6 +3,10 @@ import rp from "request-promise";
|
||||
export default bot => {
|
||||
bot._trigger.set("wttr", new bot.trigger({
|
||||
call: /^\.wttr .*/i,
|
||||
help: {
|
||||
text: "Gets the weather from wttr.in",
|
||||
usage: "[b].wttr[/b] [i]<location>[/i]"
|
||||
},
|
||||
clients: ["irc"],
|
||||
f: e => {
|
||||
let args = e.message.trim().substring(6);
|
||||
@ -60,6 +64,10 @@ export default bot => {
|
||||
|
||||
bot._trigger.set("weather", new bot.trigger({
|
||||
call: /^(\.|\/)weather .*/i,
|
||||
help: {
|
||||
text: "Gets the weather from Yahoo weather API",
|
||||
usage: "[b].weather[/b] [i]<location>[/i]"
|
||||
},
|
||||
f: e => {
|
||||
const loc = e.message.trim().substring(9);
|
||||
const url = `https://query.yahooapis.com/v1/public/yql?format=json&q=`
|
||||
|
Loading…
Reference in New Issue
Block a user