macbone

Untitled

Aug 14th, 2025
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const scheduleJoinQuest = () => {
  2.   const habId = '6ab8c0b8-adbb-4a09-8a98-7d3adf19d190';
  3.   const habToken = 'f33868c0-889b-4293-b707-3eebf3975835';
  4.   const partyAPI = 'https://habitica.com/api/v3/groups/party';
  5.   const headers = {
  6.     'x-api-user': habId,
  7.     'x-api-key': habToken,
  8.     "x-client": '${habId}-scheduleJoinQuest'
  9.   };
  10.   const response = UrlFetchApp.fetch(
  11.     partyAPI,
  12.     {
  13.       method: 'get',
  14.       headers
  15.     }
  16.   );
  17.   const { data: { quest } } = JSON.parse(response);
  18.  
  19.   if (quest.key && !quest.active && !quest.members[habId]) {
  20.     UrlFetchApp.fetch(
  21.       `${partyAPI}/quests/accept`,
  22.       {
  23.         method: 'post',
  24.         headers
  25.       }
  26.     );
  27.   }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment