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

Update plugins/antiban.js

Browse files
Files changed (1) hide show
  1. plugins/antiban.js +54 -0
plugins/antiban.js CHANGED
@@ -58,6 +58,60 @@ const GetChatRaw = async (username) => {
58
  }
59
  }
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  /**
62
  * @swagger
63
  * /api/v1/user/raw/getchat:
 
58
  }
59
  }
60
 
61
+ const GetAuthorChat = async (username) => {
62
+ const options = {
63
+ method: 'GET',
64
+ url: 'https://randydev-meta-ai.hf.space/user/author/admin',
65
+ params: {
66
+ username: username
67
+ }
68
+ };
69
+ try {
70
+ const response = await axios.request(options);
71
+ return response.data;
72
+ } catch (error) {
73
+ console.error(error);
74
+ return null;
75
+ }
76
+ }
77
+
78
+ /**
79
+ * @swagger
80
+ * /api/v1/user/author/admin:
81
+ * get:
82
+ * summary: Telegram Author Admin
83
+ * tags: [User]
84
+ * parameters:
85
+ * - in: query
86
+ * name: username
87
+ * required: true
88
+ * description: null
89
+ * schema:
90
+ * type: string
91
+ * - in: header
92
+ * name: x-api-key
93
+ * required: true
94
+ * description: API key for authentication
95
+ * schema:
96
+ * type: string
97
+ * responses:
98
+ * 200:
99
+ * description: Success
100
+ */
101
+ AntibanRoutes.get("/api/v1/user/author/admin", authenticateApiKey, apiLimiter, async (req, res) => {
102
+ const Username = req.query.username;
103
+ if (!Username) {
104
+ return res.status(400).json({ error: "Invalid or missing username" });
105
+ }
106
+ try {
107
+ const result = await GetAuthorChat(Username);
108
+ res.json(result);
109
+ } catch (error) {
110
+ res.status(500).json({ error: "Failed to fetch user info" });
111
+ }
112
+ });
113
+
114
+
115
  /**
116
  * @swagger
117
  * /api/v1/user/raw/getchat: