This commit is contained in:
Flummi 2020-03-01 13:06:30 +01:00
parent d437b580f3
commit 3b2c79275f
5 changed files with 47 additions and 15 deletions

View File

@ -11,9 +11,8 @@
"author": "Flummi & jkhsjdhjs",
"license": "WTFPL",
"dependencies": {
"cuffeo": "^1.0.5-2",
"flumm-fetch-cookies": "^1.3.4-1",
"pg": "^7.14.0",
"stringify-object": "^3.3.0"
"cuffeo": "^1.0.6",
"flumm-fetch-cookies": "^1.3.5",
"pg": "^7.14.0"
}
}

View File

@ -1,4 +1,5 @@
import _fs from "fs";
import repl from "repl";
import cuffeo from "cuffeo";
import config from "../cfg/config.json";
import logger from "./inc/log.mjs";
@ -53,4 +54,11 @@ const timeout = 1000;
console.timeEnd("loading");
const r = repl.start({
prompt: "> ",
useGlobal: true,
ignoreUndefined: true
});
r.context.self = self;
r.context.user = user;
})();

View File

@ -17,11 +17,38 @@ let context = vm.createContext({
export default async bot => {
return [{
name: "tmp",
call: /^\.penis/i,
name: "trigger",
call: /^\.trigger/i,
level: 100,
f: async e => {
console.log(e);
e.reply("schau in die Konsole lol");
switch(e.args[0]) {
case "add":
try {
let args = e.args.slice(1);
const match = args.join` `.match(/^\/(?<regex>.*)\/(?<flags1>(?!\\)[gimy]+)?(?<flags>[gimy]+)?\s(?<cmd>.*)/).groups;
const blah = {
orig: args.join` `,
regex: match.regex,
flags: (match.flags1 ? match.flags1 : "") + (match.flags ? match.flags : ""),
cmd: match.cmd
};
console.log(
blah
);
} catch(err) {
console.error(err);
}
break;
case "del":
break;
default:
break;
}
}
}, {
name: "level",

View File

@ -27,16 +27,14 @@ export default async bot => {
if(u.lastfm === null || u.lastfm === "")
return e.reply("nope");
let res = await (await fetch(`${api}${u.lastfm}`)).json();
const res = await (await fetch(`${api}${u.lastfm}`)).json();
if(res.error)
return e.reply("User not found");
res = res.recenttracks;
const track = res.track[0];
const info = {
user: res["@attr"].user,
track: `${track.artist["#text"]} - ${track.name}`,
playing: track["@attr"] ? true : false
user: e.user.nick, //res["@attr"].user,
track: `${res.recenttracks.track[0].artist["#text"]} - ${res.recenttracks.track[0].name}`,
playing: !!res.recenttracks.track[0]["@attr"]
};
return e.reply(info.playing ?

View File

@ -30,7 +30,7 @@ export default async bot => {
f: async e => {
const user = await ts();
e.reply(`aktuell ${user.length === 1 ? "ist" : "sind"} ${user.length} Nase${user.length === 1 ? "" : "n"} mit f0ck.space verbunden${user.length === 0 ? "." : ": " }${user.join(", ")}`);
e.reply(`aktuell ${user.length === 1 ? "ist" : "sind"} ${user.length} Nase${user.length === 1 ? "" : "n"} mit f0ck.space verbunden${user.length === 0 ? "." : ": " }${user.join(", ").replace(/\\s/, " ")}`);
}
}]
};