Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const scheduleJoinQuest = () => {
- const habId = '6ab8c0b8-adbb-4a09-8a98-7d3adf19d190';
- const habToken = 'f33868c0-889b-4293-b707-3eebf3975835';
- const partyAPI = 'https://habitica.com/api/v3/groups/party';
- const headers = {
- 'x-api-user': habId,
- 'x-api-key': habToken,
- "x-client": '${habId}-scheduleJoinQuest'
- };
- const response = UrlFetchApp.fetch(
- partyAPI,
- {
- method: 'get',
- headers
- }
- );
- const { data: { quest } } = JSON.parse(response);
- if (quest.key && !quest.active && !quest.members[habId]) {
- UrlFetchApp.fetch(
- `${partyAPI}/quests/accept`,
- {
- method: 'post',
- headers
- }
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment