Spaces:
Sleeping
Sleeping
DmitrMakeev
commited on
Commit
•
f0010dd
1
Parent(s):
3d0aecc
Update up_ad.html
Browse files- up_ad.html +6 -2
up_ad.html
CHANGED
@@ -51,7 +51,7 @@
|
|
51 |
<div class="input-row">
|
52 |
<input type="text" id="apiKeyInput" placeholder="Enter API Key">
|
53 |
<input type="text" id="groupIdInput" placeholder="Enter Group ID">
|
54 |
-
<input type="text" id="participantChatIdInput" placeholder="Enter Participant
|
55 |
</div>
|
56 |
<button id="setAdminButton">Set Group Admin</button>
|
57 |
|
@@ -59,11 +59,15 @@
|
|
59 |
document.getElementById('setAdminButton').addEventListener('click', function() {
|
60 |
const apiKey = document.getElementById('apiKeyInput').value;
|
61 |
const groupId = document.getElementById('groupIdInput').value;
|
62 |
-
|
63 |
if (!apiKey || !groupId || !participantChatId) {
|
64 |
alert('Please fill in all fields.');
|
65 |
return;
|
66 |
}
|
|
|
|
|
|
|
|
|
67 |
setGroupAdmin(apiKey, groupId, participantChatId);
|
68 |
});
|
69 |
async function setGroupAdmin(apiKey, groupId, participantChatId) {
|
|
|
51 |
<div class="input-row">
|
52 |
<input type="text" id="apiKeyInput" placeholder="Enter API Key">
|
53 |
<input type="text" id="groupIdInput" placeholder="Enter Group ID">
|
54 |
+
<input type="text" id="participantChatIdInput" placeholder="Enter Participant Phone Number">
|
55 |
</div>
|
56 |
<button id="setAdminButton">Set Group Admin</button>
|
57 |
|
|
|
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 |
alert('Please fill in all fields.');
|
65 |
return;
|
66 |
}
|
67 |
+
// Add the @c.us suffix if it's not already present
|
68 |
+
if (!participantChatId.includes('@c.us')) {
|
69 |
+
participantChatId = participantChatId + '@c.us';
|
70 |
+
}
|
71 |
setGroupAdmin(apiKey, groupId, participantChatId);
|
72 |
});
|
73 |
async function setGroupAdmin(apiKey, groupId, participantChatId) {
|