Update plugins/antiban.js
Browse files- plugins/antiban.js +53 -0
plugins/antiban.js
CHANGED
@@ -24,6 +24,23 @@ const TelegramUser = async (user_id) => {
|
|
24 |
}
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
const TelegramUserStoryDL = async (link) => {
|
28 |
const options = {
|
29 |
method: 'GET',
|
@@ -75,6 +92,42 @@ const GetAuthorChat = async (username) => {
|
|
75 |
}
|
76 |
}
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
/**
|
79 |
* @swagger
|
80 |
* /api/v1/user/author/admin:
|
|
|
24 |
}
|
25 |
}
|
26 |
|
27 |
+
const TelegramUserStatusBan = async (user_id) => {
|
28 |
+
const options = {
|
29 |
+
method: 'GET',
|
30 |
+
url: 'https://randydev-meta-ai.hf.space/user/status/ban',
|
31 |
+
params: {
|
32 |
+
username: user_id
|
33 |
+
}
|
34 |
+
};
|
35 |
+
try {
|
36 |
+
const response = await axios.request(options);
|
37 |
+
return response.data;
|
38 |
+
} catch (error) {
|
39 |
+
console.error(error);
|
40 |
+
return null;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
const TelegramUserStoryDL = async (link) => {
|
45 |
const options = {
|
46 |
method: 'GET',
|
|
|
92 |
}
|
93 |
}
|
94 |
|
95 |
+
/**
|
96 |
+
* @swagger
|
97 |
+
* /api/v1/user/status/ban:
|
98 |
+
* get:
|
99 |
+
* summary: Telegram User Status Ban
|
100 |
+
* tags: [User]
|
101 |
+
* parameters:
|
102 |
+
* - in: query
|
103 |
+
* name: username
|
104 |
+
* required: true
|
105 |
+
* description: null
|
106 |
+
* schema:
|
107 |
+
* type: string
|
108 |
+
* - in: header
|
109 |
+
* name: x-api-key
|
110 |
+
* required: true
|
111 |
+
* description: API key for authentication
|
112 |
+
* schema:
|
113 |
+
* type: string
|
114 |
+
* responses:
|
115 |
+
* 200:
|
116 |
+
* description: Success
|
117 |
+
*/
|
118 |
+
AntibanRoutes.get("/api/v1/user/status/ban", authenticateApiKey, apiLimiter, async (req, res) => {
|
119 |
+
const Username = req.query.username;
|
120 |
+
if (!Username) {
|
121 |
+
return res.status(400).json({ error: "Invalid or missing username" });
|
122 |
+
}
|
123 |
+
try {
|
124 |
+
const result = await TelegramUserStatusBan(Username);
|
125 |
+
res.json(result);
|
126 |
+
} catch (error) {
|
127 |
+
res.status(500).json({ error: "Failed to fetch user info" });
|
128 |
+
}
|
129 |
+
});
|
130 |
+
|
131 |
/**
|
132 |
* @swagger
|
133 |
* /api/v1/user/author/admin:
|