local sync

This commit is contained in:
Flummi
2019-04-24 15:26:39 +02:00
parent 67b0fc291a
commit 175b994be3
12 changed files with 160 additions and 35 deletions

View File

@@ -1,4 +1,5 @@
import sql from "../sql";
import fetch from "../fetch";
let _query_get = `
with ranked_quotes as (
@@ -23,6 +24,18 @@ insert into nxy_quotes
`;
export default bot => {
bot._trigger.set("qrnd", new bot.trigger({
call: /^(\.|\/)qrnd$/i,
set: "all",
f: e => {
fetch("https://nxy.totally.rip/api/quotes.php?c=nick,item")
.then(res => res.json())
.then(res => {
const quote = res.data.quotes[~~(Math.random() * res.data.quotes.length)];
e.reply(`<[b]${quote.nick}[/b]> [i]${quote.item}[/i]`);
}).catch(console.error);
}
}));
bot._trigger.set("quotes", new bot.trigger({
call: /^(\.|\/)q .*/i,
set: "nxy",