Spaces:
Sleeping
Sleeping
DmitrMakeev
commited on
Commit
•
4d18af2
1
Parent(s):
38c49e7
Update up_ad.html
Browse files- up_ad.html +28 -7
up_ad.html
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
6 |
<title>Manage Group Admin</title>
|
7 |
<style>
|
8 |
body {
|
@@ -47,21 +48,28 @@
|
|
47 |
</style>
|
48 |
</head>
|
49 |
<body>
|
50 |
-
<h1
|
51 |
<div class="input-row">
|
52 |
-
<input type="text" id="apiKeyInput" placeholder="
|
53 |
-
<input type="text" id="groupIdInput" placeholder="
|
54 |
-
<input type="text" id="participantChatIdInput" placeholder="
|
55 |
</div>
|
56 |
<button id="setAdminButton">Set Group Admin</button>
|
57 |
-
|
58 |
<script>
|
59 |
document.getElementById('setAdminButton').addEventListener('click', function() {
|
60 |
const apiKey = document.getElementById('apiKeyInput').value;
|
61 |
const groupId = document.getElementById('groupIdInput').value;
|
62 |
let participantChatId = document.getElementById('participantChatIdInput').value;
|
63 |
if (!apiKey || !groupId || !participantChatId) {
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
return;
|
66 |
}
|
67 |
// Add the @c.us suffix if it's not already present
|
@@ -91,9 +99,22 @@
|
|
91 |
const data = await response.json();
|
92 |
if (data.setGroupAdmin === false && data.error === "participant not found") {
|
93 |
alert('Добавьте пользователя в группу');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
} else {
|
95 |
console.log('Admin set successfully:', data);
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
}
|
98 |
} catch (error) {
|
99 |
console.error('Error setting admin:', error);
|
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
|
7 |
<title>Manage Group Admin</title>
|
8 |
<style>
|
9 |
body {
|
|
|
48 |
</style>
|
49 |
</head>
|
50 |
<body>
|
51 |
+
<h1>Добавления администратора закрытой группы</h1>
|
52 |
<div class="input-row">
|
53 |
+
<input type="text" id="apiKeyInput" placeholder="Вставьте API ключ">
|
54 |
+
<input type="text" id="groupIdInput" placeholder="Вставьте ID группы">
|
55 |
+
<input type="text" id="participantChatIdInput" placeholder="Телефое администратора">
|
56 |
</div>
|
57 |
<button id="setAdminButton">Set Group Admin</button>
|
58 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
|
59 |
<script>
|
60 |
document.getElementById('setAdminButton').addEventListener('click', function() {
|
61 |
const apiKey = document.getElementById('apiKeyInput').value;
|
62 |
const groupId = document.getElementById('groupIdInput').value;
|
63 |
let participantChatId = document.getElementById('participantChatIdInput').value;
|
64 |
if (!apiKey || !groupId || !participantChatId) {
|
65 |
+
|
66 |
+
Toastify({
|
67 |
+
text: "Пожалуйста заполните все поля!",
|
68 |
+
duration: 3000,
|
69 |
+
gravity: "top",
|
70 |
+
position: "center",
|
71 |
+
backgroundColor: "#fc0303",
|
72 |
+
}).showToast();
|
73 |
return;
|
74 |
}
|
75 |
// Add the @c.us suffix if it's not already present
|
|
|
99 |
const data = await response.json();
|
100 |
if (data.setGroupAdmin === false && data.error === "participant not found") {
|
101 |
alert('Добавьте пользователя в группу');
|
102 |
+
Toastify({
|
103 |
+
text: "Пользователь должен быть в группе!",
|
104 |
+
duration: 3000,
|
105 |
+
gravity: "top",
|
106 |
+
position: "center",
|
107 |
+
backgroundColor: "#fc0303",
|
108 |
+
}).showToast();
|
109 |
} else {
|
110 |
console.log('Admin set successfully:', data);
|
111 |
+
Toastify({
|
112 |
+
text: "Администратор добавлен!",
|
113 |
+
duration: 3000,
|
114 |
+
gravity: "top",
|
115 |
+
position: "center",
|
116 |
+
backgroundColor: "#56fcb7",
|
117 |
+
}).showToast();
|
118 |
}
|
119 |
} catch (error) {
|
120 |
console.error('Error setting admin:', error);
|