löler
This commit is contained in:
parent
2988582905
commit
e1b72f0f47
|
@ -15,7 +15,7 @@ const timeout = 1000;
|
|||
this.level = args.level || 0;
|
||||
this.active = args.hasOwnProperty("active") ? args.active : true;
|
||||
this.set = args.set || "all"; // uwe, nxy, f0ck, all
|
||||
this.clients = args.clients || [ "irc", "tg" ];
|
||||
this.clients = args.clients || [ "irc", "tg", "slack" ];
|
||||
this.f = args.f;
|
||||
},
|
||||
bot: await new cuffeo(config.clients)
|
||||
|
|
|
@ -32,7 +32,7 @@ export default async bot => {
|
|||
console.log(`triggered > ${t[0]}`);
|
||||
}
|
||||
catch(error) {
|
||||
e.reply("An error occured.");
|
||||
e.reply(`${t[0]}: An error occured.`);
|
||||
logger.error(`${e.network} -> ${e.channel} -> ${e.user.nick}: ${error.toString ? error : JSON.stringify(error)}`);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -5,6 +5,7 @@ export default async bot => {
|
|||
name: "chatbot",
|
||||
call: /^(?![!./[])(.*uw(e|i).*)/i,
|
||||
set: "uwe",
|
||||
active: false,
|
||||
f: async e => {
|
||||
const res = await cleverbot.ask(e.message
|
||||
.replace(/uw(e|i)/gi, "")
|
||||
|
|
|
@ -19,7 +19,7 @@ export default new class cleverbot {
|
|||
fetch(`${this.api}/create`, options)
|
||||
.then(res => res.json())
|
||||
.then(res => this.nick = res.status === "success" ? res.nick: "uwibot")
|
||||
.catch(err => console.log(err));
|
||||
.catch(err => console.log("cleverbot is offline or whatever lol"));
|
||||
}
|
||||
|
||||
ask(msg) {
|
||||
|
@ -37,7 +37,7 @@ export default new class cleverbot {
|
|||
fetch(`${this.api}/ask`, options)
|
||||
.then(res => res.json())
|
||||
.then(res => res.status === "success"?resolve(res):reject(res.status))
|
||||
.catch(err => reject(err));
|
||||
.catch(err => reject("cleverbot is offline or whatever lol"));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
22
src/inc/trigger/mcversion.mjs
Normal file
22
src/inc/trigger/mcversion.mjs
Normal file
|
@ -0,0 +1,22 @@
|
|||
import fetch from "flumm-fetch-cookies";
|
||||
|
||||
const baseurl = "https://launchermeta.mojang.com/mc/game/version_manifest.json";
|
||||
|
||||
export default async bot => {
|
||||
return [{
|
||||
name: "mcversion",
|
||||
call: /^(\.|\/)mcv$/i,
|
||||
f: async e => {
|
||||
const res = await (await fetch(baseurl)).json();
|
||||
const latest = {
|
||||
release: res.versions.filter(a => a.id === res.latest.release)[0],
|
||||
snapshot: res.versions.filter(a => a.id === res.latest.snapshot)[0]
|
||||
};
|
||||
|
||||
e.reply([
|
||||
`Release: [b]${latest.release.id}[/b] (${new Date(latest.release.releaseTime).toLocaleString()})`,
|
||||
`Snapshot: [b]${latest.snapshot.id}[/b] (${new Date(latest.snapshot.releaseTime).toLocaleString()})`
|
||||
]);
|
||||
}
|
||||
}]
|
||||
};
|
36
src/inc/trigger/ts.mjs
Normal file
36
src/inc/trigger/ts.mjs
Normal file
|
@ -0,0 +1,36 @@
|
|||
import net from "net";
|
||||
|
||||
const ts = async () => new Promise(resolve => {
|
||||
const sock = net.connect({
|
||||
host: "f0ck.space",
|
||||
port: 10011
|
||||
}).setEncoding("utf-8");
|
||||
sock.write("use sid=1\n");
|
||||
sock.write("clientlist\n");
|
||||
sock.on("data", e => {
|
||||
if(!e.match(/clid/)) return;
|
||||
sock.destroy();
|
||||
return resolve(e
|
||||
.split("|")
|
||||
.filter(f => f.match(/client_type=0/))
|
||||
.map(f => f
|
||||
.split(" ")
|
||||
.filter(g => g.match(/client_nickname/))
|
||||
.map(g => g.split("=")[1])
|
||||
)
|
||||
.flat()
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
export default async bot => {
|
||||
return [{
|
||||
name: "ts",
|
||||
call: /^(\.|\/)ts$/i,
|
||||
f: async e => {
|
||||
const user = await ts();
|
||||
|
||||
e.reply(`aktuell sind ${user.length} Nasen mit f0ck.space verbunden: ${user.join``}`);
|
||||
}
|
||||
}]
|
||||
};
|
Loading…
Reference in New Issue
Block a user