This commit is contained in:
Flummi 2022-05-13 16:26:12 +00:00
parent ec438f45ef
commit 3f71519f81
13 changed files with 22 additions and 20 deletions

View File

@ -11,8 +11,8 @@
"author": "Flummi & jkhsjdhjs", "author": "Flummi & jkhsjdhjs",
"license": "WTFPL", "license": "WTFPL",
"dependencies": { "dependencies": {
"cleverbot-free": "^1.1.7", "cleverbot-free": "^1.1.11",
"cuffeo": "^1.0.7-3", "cuffeo": "^1.2.1",
"flumm-fetch-cookies": "^1.4.0", "flumm-fetch-cookies": "^1.4.0",
"pg": "^8.3.0" "pg": "^8.3.0"
} }

View File

@ -1,7 +1,7 @@
import _fs from "fs"; import _fs from "fs";
import repl from "repl"; import repl from "repl";
import cuffeo from "cuffeo"; import cuffeo from "cuffeo";
import config from "../cfg/config.json"; import config from "./inc/config.mjs";
import logger from "./inc/log.mjs"; import logger from "./inc/log.mjs";
import user from "./inc/user.mjs"; import user from "./inc/user.mjs";

View File

@ -1,4 +1,4 @@
import config from "../../cfg/config.json"; import config from "./config.mjs";
export const getLevel = (network, user) => { export const getLevel = (network, user) => {
let ret = { let ret = {

2
src/inc/config.mjs Normal file
View File

@ -0,0 +1,2 @@
import config from "../../cfg/config.json" assert { type: "json" };
export default config;

View File

@ -1,4 +1,4 @@
import PG from "pg"; import PG from "pg";
import config from "../../cfg/config.json"; import config from "./config.mjs";
export default new PG.Pool(config.sql); export default new PG.Pool(config.sql);

View File

@ -1,5 +1,5 @@
import fetch from "flumm-fetch-cookies"; import fetch from "flumm-fetch-cookies";
import config from "../../../cfg/config.json"; import config from "../config.mjs";
export default async bot => { export default async bot => {
@ -11,4 +11,4 @@ export default async bot => {
e.reply([ "Here are the top 3 Google results:", res.items.map((r, i) => `${i+1}: ${r.title} - ${r.link}`)].flat()); e.reply([ "Here are the top 3 Google results:", res.items.map((r, i) => `${i+1}: ${r.title} - ${r.link}`)].flat());
} }
}]; }];
}; };

View File

@ -3,7 +3,7 @@ export default async bot => {
return [{ return [{
name: "help", name: "help",
call: /^(\.|\/)help/i, call: /^(\.|\/)help/i,
active: false, active: true,
f: e => { f: e => {
if(e.args[0] && [...bot._trigger.keys()].includes(e.args[0])) { if(e.args[0] && [...bot._trigger.keys()].includes(e.args[0])) {
const help = bot._trigger.get(e.args[0]).help; const help = bot._trigger.get(e.args[0]).help;
@ -13,10 +13,10 @@ export default async bot => {
else { else {
let triggers = []; let triggers = [];
[...bot._trigger.entries()] [...bot._trigger.entries()]
.filter(trigger => trigger[1].help) //.filter(trigger => trigger[1].help)
.forEach(trigger => triggers.push(trigger[0])); .forEach(trigger => triggers.push(trigger[0]));
e.reply(`(WIP) available commands: ${triggers.map(blah => `[b]${blah}[/b]`).join(", ")}`); e.reply(`(WIP) available commands: ${triggers.map(blah => `[b]${blah}[/b]`).join(", ")}`);
} }
} }
}]; }];
}; };

View File

@ -1,5 +1,5 @@
import fetch from "flumm-fetch-cookies"; import fetch from "flumm-fetch-cookies";
import config from "../../../cfg/config.json"; import config from "../config.mjs";
const api = `https://robot-ws.your-server.de`; const api = `https://robot-ws.your-server.de`;
const auth = { const auth = {

View File

@ -1,5 +1,5 @@
import fetch from "flumm-fetch-cookies"; import fetch from "flumm-fetch-cookies";
import config from "../../../cfg/config.json"; import config from "../config.mjs";
import user from "../user.mjs"; import user from "../user.mjs";
const api = `http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&limit=1&api_key=${config.apis.lastfm.key}&format=json&user=`; const api = `http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&limit=1&api_key=${config.apis.lastfm.key}&format=json&user=`;
@ -25,7 +25,7 @@ export default async bot => {
return e.reply("nope"); return e.reply("nope");
const u = user.get(e.user.prefix); const u = user.get(e.user.prefix);
if(u.lastfm === null || u.lastfm === "") if(u.lastfm === null || u.lastfm === "")
return e.reply("nope"); return e.reply("set up an account first: .np =username");
const res = await (await fetch(`${api}${u.lastfm}`)).json(); const res = await (await fetch(`${api}${u.lastfm}`)).json();
if(res.error) if(res.error)

View File

@ -1,5 +1,5 @@
import {default as fetch, cookieJar, Cookie} from "flumm-fetch-cookies"; import {default as fetch, cookieJar, Cookie} from "flumm-fetch-cookies";
import cfg from "../../../cfg/config.json"; import cfg from "../config.mjs";
const apis = { const apis = {
reverse: "https://pr0gramm.com/api/items/get?flags=15&tags=!p:", reverse: "https://pr0gramm.com/api/items/get?flags=15&tags=!p:",

View File

@ -1,5 +1,5 @@
import fetch from "flumm-fetch-cookies"; import fetch from "flumm-fetch-cookies";
import config from "../../../cfg/config.json"; import config from "../config.mjs";
export default async bot => { export default async bot => {

View File

@ -25,11 +25,11 @@ export default async bot => {
return e.reply(meme.url); return e.reply(meme.url);
} }
}, { }, {
name: "randomotter", name: "randomvieh",
call: /^(\.|\/)otter$/i, call: /^(\.|\/)(otter|bunny)$/i,
f: async e => { f: async e => {
const otter = await (await fetch("https://api.tinyfox.dev/img?animal=otter&json")).json(); const vieh = await (await fetch(`https://api.tinyfox.dev/img?animal=${e.cmd}&json`)).json();
return e.reply(`https://api.tinyfox.dev${otter.loc}`); return e.reply(`https://api.tinyfox.dev${vieh.loc}`);
} }
}] }]
}; };

View File

@ -1,5 +1,5 @@
import fetch from "flumm-fetch-cookies"; import fetch from "flumm-fetch-cookies";
import config from "../../../cfg/config.json"; import config from "../config.mjs";
import { conds } from "./lib/wttr.mjs"; import { conds } from "./lib/wttr.mjs";
export default async bot => { export default async bot => {