Skip to content

Commit

Permalink
Merge pull request #1290 from TransformerOptimus/delete_event_calenda…
Browse files Browse the repository at this point in the history
…r_fix

calendar issues fixed
  • Loading branch information
Tarraann authored Sep 29, 2023
2 parents 1224489 + 90c45e7 commit 14ffef2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion superagi/tools/google_calendar/delete_calendar_event.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import base64
from typing import Any, Type
from pydantic import BaseModel, Field
from superagi.tools.base_tool import BaseTool
Expand All @@ -24,8 +25,13 @@ def _execute(self, event_id: str):
if event_id == "None":
return f"Add Event ID to delete an event from Google Calendar"
else:
if len(event_id) % 4 != 0:
event_id += "=" * (4 - (len(event_id) % 4))
decoded_id = base64.b64decode(event_id)
eid = decoded_id.decode("utf-8")
eid = eid.split(" ", 1)[0]
result = service.events().delete(
calendarId = "primary",
eventId = event_id
eventId = eid
).execute()
return f"Event Successfully deleted from your Google Calendar"
2 changes: 2 additions & 0 deletions superagi/tools/google_calendar/event_details_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def _execute(self, event_id: str):
if event_id == "None":
return f"Add Event ID to fetch details of an event from Google Calendar"
else:
if len(event_id) % 4 != 0:
event_id += "=" * (4 - (len(event_id) % 4))
decoded_id = base64.b64decode(event_id)
eid = decoded_id.decode("utf-8")
eid = eid.split(" ", 1)[0]
Expand Down

0 comments on commit 14ffef2

Please sign in to comment.