This commit is contained in:
lolcat 2024-03-30 21:04:47 -04:00
parent c8efc9bdd1
commit 7bb22325fa
1 changed files with 29 additions and 43 deletions

View File

@ -23,7 +23,7 @@ var ddg_mod = true; // dont show porn in .img
var global_page = 1; // .img page var global_page = 1; // .img page
var raid = false; // raid? var raid = false; // raid?
var img_headers = { var img_headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/120.0", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.5", "Accept-Language": "en-US,en;q=0.5",
"Accept-Encoding": "gzip, deflate", "Accept-Encoding": "gzip, deflate",
@ -33,40 +33,9 @@ var img_headers = {
var headers = { var headers = {
"User-Agent": "renabot", "User-Agent": "renabot",
Origin: "https://deek.chat" "Origin": "https://deek.chat"
}; };
// create sekrit http interface
const http_server = http.createServer(async function(req, res){
res.setHeader("Content-Type", "text/html");
switch(req.url){
case "/renatest":
res.writeHead(200);
setTimeout(function(){
fs.utimesSync(__filename, Date.now(), Date.now());
}, 1000);
res.end("Restarted piece of shit bot!!! lollllll");
break;
case "/":
res.writeHead(200);
res.end("Deek has a stinky penis");
break;
default:
res.writeHead(404);
res.end("<marquee>dumbass<marquee>");
break;
}
});
http_server.listen(8000, "0.0.0.0", function(){
console.log("Started http serber");
});
/* /*
Helper functions Helper functions
*/ */
@ -109,7 +78,10 @@ async function serveddg(msg, results, page){
var res = await fetch( var res = await fetch(
results[page].image, results[page].image,
{headers: img_headers} {
headers: img_headers,
signal: AbortSignal.timeout(3000)
}
); );
var res_get = await res.buffer(); var res_get = await res.buffer();
@ -122,7 +94,10 @@ async function serveddg(msg, results, page){
var res = await fetch( var res = await fetch(
results[page].thumbnail, results[page].thumbnail,
{headers: img_headers} {
headers: img_headers,
signal: AbortSignal.timeout(5000)
}
); );
var res_get = await res.buffer(); var res_get = await res.buffer();
@ -132,7 +107,10 @@ async function serveddg(msg, results, page){
var res = await fetch( var res = await fetch(
results[page].thumbnail, results[page].thumbnail,
{headers: img_headers} {
headers: img_headers,
signal: AbortSignal.timeout(5000)
}
); );
var res_get = await res.buffer(); var res_get = await res.buffer();
@ -396,12 +374,12 @@ deek.on("message", async function(msg, user){
){ ){
return; return;
} }
/*
if(user.id === 5311){ if(user.id === 5311){
user.name = msg.text.split(">")[0].substr(1); user.name = msg.text.split(">")[0].substr(1);
msg.text = msg.text.split(">").splice(1).join(">").trim(); msg.text = msg.text.split(">").splice(1).join(">").trim();
} }*/
switch(msg.text.toLowerCase()){ switch(msg.text.toLowerCase()){
@ -414,7 +392,11 @@ deek.on("message", async function(msg, user){
case "/help": case "/help":
send(msg, "lmao newfag"); send(msg, "lmao newfag");
break; return;
case "fuck you rena":
send(msg, "fuck you eagle");
return;
} }
/* /*
@ -429,7 +411,7 @@ deek.on("message", async function(msg, user){
if(tweet = link.match(/https?:\/\/(?:www\.)?twitter\.com\/[A-Za-z0-9_]+\/status\/([0-9]+)/)){ if(tweet = link.match(/https?:\/\/(?:www\.)?twitter\.com\/[A-Za-z0-9_]+\/status\/([0-9]+)/)){
tweet = tweet[1]; tweet = tweet[1];
var res = await fetch("https://cdn.syndication.twimg.com/tweet-result?id=" + tweet); var res = await fetch("https://cdn.syndication.twimg.com/tweet-result?id=" + tweet + "&token=2rkokdcv41v");
var json = await res.json(); var json = await res.json();
var title = json.user.name + " (@" + json.user.screen_name + ") " + " on twatter"; var title = json.user.name + " (@" + json.user.screen_name + ") " + " on twatter";
@ -439,7 +421,10 @@ deek.on("message", async function(msg, user){
var res = await fetch( var res = await fetch(
link, link,
{headers: img_headers} {
headers: img_headers,
signal: AbortSignal.timeout(5000)
}
); );
var headers_arr = [...res.headers]; var headers_arr = [...res.headers];
@ -717,7 +702,8 @@ deek.on("message", async function(msg, user){
ddg.image_search( ddg.image_search(
{ {
query: value, query: value,
moderate: ddg_mod moderate: ddg_mod,
iterations: 1
} }
).then(async results => { ).then(async results => {
@ -822,7 +808,7 @@ deek.on("message", async function(msg, user){
break; break;
} }
var res = await fetch("https://4get.perennialte.ch/api/v1/videos?s=" + encodeURIComponent(value)); var res = await fetch("https://4get.zzls.xyz/api/v1/videos?s=" + encodeURIComponent(value));
var res_get = await res.json(); var res_get = await res.json();
if(res_get.status != "ok"){ if(res_get.status != "ok"){