DmitrMakeev commited on
Commit
3d0aecc
1 Parent(s): 30d9d78

Update up_ad.html

Browse files
Files changed (1) hide show
  1. up_ad.html +6 -3
up_ad.html CHANGED
@@ -66,7 +66,6 @@
66
  }
67
  setGroupAdmin(apiKey, groupId, participantChatId);
68
  });
69
-
70
  async function setGroupAdmin(apiKey, groupId, participantChatId) {
71
  const url = `https://api.green-api.com/waInstance1101952913/setGroupAdmin/${apiKey}`;
72
  const payload = {
@@ -86,8 +85,12 @@
86
  throw new Error(`HTTP error! status: ${response.status}`);
87
  }
88
  const data = await response.json();
89
- console.log('Admin set successfully:', data);
90
- alert('Admin set successfully!');
 
 
 
 
91
  } catch (error) {
92
  console.error('Error setting admin:', error);
93
  alert('Error setting admin. Please check the console for details.');
 
66
  }
67
  setGroupAdmin(apiKey, groupId, participantChatId);
68
  });
 
69
  async function setGroupAdmin(apiKey, groupId, participantChatId) {
70
  const url = `https://api.green-api.com/waInstance1101952913/setGroupAdmin/${apiKey}`;
71
  const payload = {
 
85
  throw new Error(`HTTP error! status: ${response.status}`);
86
  }
87
  const data = await response.json();
88
+ if (data.setGroupAdmin === false && data.error === "participant not found") {
89
+ alert('Добавьте пользователя в группу');
90
+ } else {
91
+ console.log('Admin set successfully:', data);
92
+ alert('Admin set successfully!');
93
+ }
94
  } catch (error) {
95
  console.error('Error setting admin:', error);
96
  alert('Error setting admin. Please check the console for details.');