forked from 2jwjejwjejejeqqq1111/sara_bot-md
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathبوت.
100 lines (91 loc) · 2.42 KB
/
بوت.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import cheerio from 'cheerio';
import fetch from 'node-fetch';
let handler = async (m, {
conn,
args,
usedPrefix,
text,
command
}) => {
if (!text) return m.reply("هلا كيف يمكنني مساعدتك اليوم؟",)
await m.reply("> اﻻنتظار من فضلك......⏳")
try {
// Example usage
let result = await CleanDx(text)
await m.reply(result)
} catch (e) {
await m.reply("error")
}
}
handler.help = ["cleandx"]
handler.tags = ["internet"]
handler.command = /^(dx|bot|بوت|vcv)$/i
export default handler
/* New Line */
async function CleanDx(your_qus) {
let linkaiList = [];
let linkaiId = generateRandomString(21);
let Baseurl = "https://vipcleandx.xyz/";
console.log(formatTime());
linkaiList.push({
"content": your_qus,
"role": "user",
"nickname": "",
"time": formatTime(),
"isMe": true
});
linkaiList.push({
"content": "Thinking...",
"role": "assistant",
"nickname": "AI",
"time": formatTime(),
"isMe": false
});
if (linkaiList.length > 10) {
linkaiList = linkaiList.shift();
}
let response = await fetch(Baseurl + "v1/chat/gpt/", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Forwarded-For": generateRandomIP(),
"Referer": Baseurl,
"accept": "application/json, text/plain, */*"
},
body: JSON.stringify({
"list": linkaiList,
"id": linkaiId,
"title": your_qus,
"prompt": "",
"temperature": 0.5,
"models": "0",
"continuous": true
})
})
const data = await response.text();
return data;
}
function generateRandomString(length) {
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
let randomString = '';
for (let i = 0; i < length; i++) {
const randomIndex = Math.floor(Math.random() * characters.length);
randomString += characters.charAt(randomIndex);
}
return randomString;
}
function generateRandomIP() {
const ipParts = [];
for (let i = 0; i < 4; i++) {
const randomPart = Math.floor(Math.random() * 256);
ipParts.push(randomPart);
}
return ipParts.join('.');
}
function formatTime() {
const currentDate = new Date();
const hours = currentDate.getHours().toString().padStart(2, '0');
const minutes = currentDate.getMinutes().toString().padStart(2, '0');
const seconds = currentDate.getSeconds().toString().padStart(2, '0');
return `${hours}:${minutes}:${seconds}`;
}