This commit is contained in:
Flummi 2020-08-03 03:23:42 +02:00
parent 3b2c79275f
commit 00d0c1f199
4 changed files with 62 additions and 6 deletions

View File

@ -11,8 +11,8 @@
"author": "Flummi & jkhsjdhjs", "author": "Flummi & jkhsjdhjs",
"license": "WTFPL", "license": "WTFPL",
"dependencies": { "dependencies": {
"cuffeo": "^1.0.6", "cuffeo": "^1.0.6-1",
"flumm-fetch-cookies": "^1.3.5", "flumm-fetch-cookies": "^1.4.0",
"pg": "^7.14.0" "pg": "^8.3.0"
} }
} }

28
src/inc/trigger/eso.mjs Normal file
View File

@ -0,0 +1,28 @@
import fetch from "flumm-fetch-cookies";
const link = "https://esoserverstatus.net/";
const regex = {
main: /<div class=\"list-group-item\">(.*?)<\/div>/sg,
info: /<b>\[(?<platform>.*)\] (?<server>.*)<\/b>.*<b>(?<status>.*)<\/b>/s
};
export default async bot => {
return [{
name: "eso",
call: /^(\.|\/)eso/i,
f: async e => {
switch(e.args[0]) {
default:
const res = await (await fetch(link)).text();
const matches = res.match(regex.main);
const info = matches.map(match => {
const tmp = match.match(regex.info).groups;
return `[${tmp.platform}] ${tmp.server} ${tmp.status}`;
});
e.reply(info);
break;
}
}
}];
};

View File

@ -1,4 +1,4 @@
import cp from "child_process"; import { exec } from "child_process";
export default async bot => { export default async bot => {
@ -6,8 +6,8 @@ export default async bot => {
name: "sysinfo", name: "sysinfo",
call: /^(\.|\/)sysinfo/i, call: /^(\.|\/)sysinfo/i,
set: "uwe", set: "uwe",
f: e => { f: async e => {
cp.exec("inxi", (err, stdout, stderr) => { exec(`inxi ${e.type !== "irc" ? "-c" : ""}`, (err, stdout, stderr) => {
e.reply(stdout); e.reply(stdout);
}); });
} }

View File

@ -0,0 +1,28 @@
import fetch from "flumm-fetch-cookies";
export default async bot => {
return [{
name: "randomcat",
call: /^(\.|\/)ka(tz|ds)(.*)$/i,
f: async e => {
const katz = await (await fetch("https://api.thecatapi.com/v1/images/search?size=full")).json();
return e.reply(katz[0]['url']);
}
}, {
name: "randomdoggo",
call: /^(\.|\/)dog(go)?(.*)$/i,
f: async e => {
const doggo = await (await fetch("https://api.thedogapi.com/v1/images/search?size=full")).json();
return e.reply(doggo[0]['url']);
}
}, {
name: "randommeme",
call: /^(\.|\/)meme(.*)$/i,
f: async e => {
const meme = await (await fetch("https://meme-api.herokuapp.com/gimme")).json();
if(meme.nsfw)
return e.reply("ups, dieses Meme wäre nsfw gewesen.");
return e.reply(meme.url);
}
}]
};