randydev commited on
Commit
d22a349
·
verified ·
1 Parent(s): be08f3f

Update plugins/antiban.js

Browse files
Files changed (1) hide show
  1. plugins/antiban.js +53 -0
plugins/antiban.js CHANGED
@@ -41,6 +41,59 @@ const TelegramUserStoryDL = async (link) => {
41
  }
42
  }
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  /**
45
  * @swagger
46
  * /api/v1/user/story-dl:
 
41
  }
42
  }
43
 
44
+ const GetChatRaw = async (username) => {
45
+ const options = {
46
+ method: 'GET',
47
+ url: 'https://randydev-meta-ai.hf.space/user/raw/getchat',
48
+ params: {
49
+ username: username
50
+ }
51
+ };
52
+ try {
53
+ const response = await axios.request(options);
54
+ return response.data;
55
+ } catch (error) {
56
+ console.error(error);
57
+ return null;
58
+ }
59
+ }
60
+
61
+ /**
62
+ * @swagger
63
+ * /api/v1/user/raw/getchat:
64
+ * get:
65
+ * summary: Telegram Get Chat
66
+ * tags: [User]
67
+ * parameters:
68
+ * - in: query
69
+ * name: username
70
+ * required: true
71
+ * description: null
72
+ * schema:
73
+ * type: string
74
+ * - in: header
75
+ * name: x-api-key
76
+ * required: true
77
+ * description: API key for authentication
78
+ * schema:
79
+ * type: string
80
+ * responses:
81
+ * 200:
82
+ * description: Success
83
+ */
84
+ AntibanRoutes.get("/api/v1/user/raw/getchat", authenticateApiKey, apiLimiter, async (req, res) => {
85
+ const Username = req.query.username;
86
+ if (!Username) {
87
+ return res.status(400).json({ error: "Invalid or missing username" });
88
+ }
89
+ try {
90
+ const result = await GetChatRaw(Username);
91
+ res.json(result);
92
+ } catch (error) {
93
+ res.status(500).json({ error: "Failed to fetch user info" });
94
+ }
95
+ });
96
+
97
  /**
98
  * @swagger
99
  * /api/v1/user/story-dl: