This commit is contained in:
Flummi 2023-07-09 03:10:28 +02:00
parent 3f71519f81
commit 17b881802e
5 changed files with 65 additions and 17 deletions

View File

@ -14,6 +14,7 @@
"cleverbot-free": "^1.1.11", "cleverbot-free": "^1.1.11",
"cuffeo": "^1.2.1", "cuffeo": "^1.2.1",
"flumm-fetch-cookies": "^1.4.0", "flumm-fetch-cookies": "^1.4.0",
"pg": "^8.3.0" "pg": "^8.3.0",
"source-server-query": "^3.0.2"
} }
} }

29
src/inc/trigger/gs.mjs Normal file
View File

@ -0,0 +1,29 @@
import fetch from 'flumm-fetch-cookies';
import { SourceQuerySocket } from 'source-server-query';
const ssq = new SourceQuerySocket();
const link = "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=135.181.16.244";
export default async bot => {
return [{
name: "gs",
call: /^(\.|\/)gs/i,
clients: ['tg'],
f: async e => {
const servers = (await (await fetch(link)).json()).response.servers;
servers.forEach(async s => {
const [ _server, _port ] = s.addr.split(':');
const info = await ssq.info(_server, _port, 1000);
const players = await ssq.players(_server, _port, 1000);
e.reply([
`${info.name} (${info.folder})`,
`map: ${info.map}`,
`players: ${info.players}/${info.max_players}${info.players > 0 ? ": " + players.map(p => p.name).join(", ") : ""}`
].join("\n"));
});
}
}];
};

View File

@ -27,7 +27,8 @@ export default async bot => {
type: "month", type: "month",
from: `${now.year}-${now.month}-01`, from: `${now.year}-${now.month}-01`,
to: `${now.year}-${now.month}-32`, to: `${now.year}-${now.month}-32`,
"subnet[]": config.apis.hetzner.subnets "subnet[]": config.apis.hetzner.subnets,
"ip[]": config.apis.hetzner.ips
} }
}; };
const res = await (await fetch(`${api}/traffic`, opts)).json(); const res = await (await fetch(`${api}/traffic`, opts)).json();

View File

@ -245,9 +245,9 @@ const translations = {
"na und": ["und weida?"], "na und": ["und weida?"],
"Geld": ["Barrne"], "Geld": ["Barrne"],
"Euro": ["Barrne €"], "Euro": ["Barrne"],
"geld ": ["Barrne"], "geld ": ["Barrne"],
"euro ": ["Barrne €"], "euro ": ["Barrne"],
"Upvote": ["Barrne"], "Upvote": ["Barrne"],
"upvote": ["Barrne"], "upvote": ["Barrne"],
@ -506,11 +506,6 @@ const translations = {
"ist gut": ["bin gerückt"], "ist gut": ["bin gerückt"],
"Ist gut": ["Bin gerückt"], "Ist gut": ["Bin gerückt"],
"gut": [
"richtig und wichtig!",
"naise Sache"
],
"nicht": ["ned"], "nicht": ["ned"],
"auf": ["uff"], "auf": ["uff"],
@ -676,15 +671,15 @@ const translations = {
"Ezio": [ "Ezio": [
"ETZIO, ALDA", "ETZIO, ALDA",
"ETZIO", "ETZIO",
"ÄZZIOH", "ÄZZIOH",
"ÄZZIO DU BIST EIN VERDAMMTER HURENSOHN" "ÄZZIO DU BIST EIN VERDAMMTER HURENSOHN"
], ],
"ETZIO": [ "ETZIO": [
"ETZIO, ALDA", "ETZIO, ALDA",
"ETZIO", "ETZIO",
"ÄZZIOH", "ÄZZIOH",
"ÄZZIO DU BIST EIN VERDAMMTER HURENSOHN" "ÄZZIO DU BIST EIN VERDAMMTER HURENSOHN"
], ],
"trivial": ["trivago"], "trivial": ["trivago"],
@ -851,6 +846,12 @@ export default words => {
translated += translateQuotationMarks(key) + ' '; translated += translateQuotationMarks(key) + ' ';
} }
} }
if(translated.trim().endsWith('.')) {
const random = Math.floor(Math.random() * dot.length);
translated.trim().replace(/\.$/, dot[random]);
}
return translated; return translated;
} }
@ -873,10 +874,11 @@ function translatePunctuation(word) {
const random = Math.floor(Math.random() * questionMark.length); const random = Math.floor(Math.random() * questionMark.length);
return word.replace('?', questionMark[random]); return word.replace('?', questionMark[random]);
} }
else if(word.endsWith('.')) { /*else if(word.endsWith('.')) {
const random = Math.floor(Math.random() * dot.length); //const random = Math.floor(Math.random() * dot.length);
return word.replace('.', dot[random]); //return word.replace('.', dot[random]);
} return word;
}*/
return word; return word;
} }

View File

@ -57,5 +57,20 @@ export default async bot => {
f: e => { f: e => {
e.reply([...e.args.join(" ")].map(l => (l === " ") ? " " : (Math.round(Math.random()) === 0) ? l.toUpperCase() : l.toLowerCase()).join``); e.reply([...e.args.join(" ")].map(l => (l === " ") ? " " : (Math.round(Math.random()) === 0) ? l.toUpperCase() : l.toLowerCase()).join``);
} }
}, {
name: "shm",
call: /^\.shm/i,
set: "all",
f: e => {
const term = e.args[0] || e.user.nick;
const index = term.search(/[aeiouäöü]/i);
if(index === -1)
return e.reply("wo Vokal du Mongo Schmongo");
const first = term.charAt(0) === term.charAt(0).toUpperCase() ? "S" : "s";
e.reply(` ${term} ${first}chm${term.slice(index).toLowerCase()} sag ich immer`);
}
}]; }];
}; };