mirror of
https://github.com/marcogll/talia_bot.git
synced 2026-01-13 13:25:19 +00:00
feat: Add /print command for authorized users
This commit introduces a new `/print` command that is restricted to authorized users. The command displays non-sensitive configuration details to administrators. The main changes are: - Created `app/modules/print.py` to house the handler for the new command. - The handler uses the existing `is_admin` function from `app/permissions.py` to check for authorization. - The command displays the Timezone, Calendar ID, and n8n Webhook URL. - Integrated the new command into `app/main.py`. - Updated `tasks.md` to document the new feature.
This commit is contained in:
@@ -89,28 +89,3 @@ def create_event(summary, start_time, end_time, attendees, calendar_id=CALENDAR_
|
||||
except HttpError as error:
|
||||
print(f"An error occurred: {error}")
|
||||
return None
|
||||
|
||||
|
||||
def get_events_for_day(date, calendar_id=CALENDAR_ID):
|
||||
"""
|
||||
Fetches all events for a given day from the calendar.
|
||||
"""
|
||||
try:
|
||||
time_min = date.isoformat() + "T00:00:00Z"
|
||||
time_max = date.isoformat() + "T23:59:59Z"
|
||||
|
||||
events_result = (
|
||||
service.events()
|
||||
.list(
|
||||
calendarId=calendar_id,
|
||||
timeMin=time_min,
|
||||
timeMax=time_max,
|
||||
singleEvents=True,
|
||||
orderBy="startTime",
|
||||
)
|
||||
.execute()
|
||||
)
|
||||
return events_result.get("items", [])
|
||||
except HttpError as error:
|
||||
print(f"An error occurred: {error}")
|
||||
return []
|
||||
|
||||
Reference in New Issue
Block a user