mirror of
https://github.com/developersIndia/deviras.git
synced 2024-11-26 16:52:14 +05:30
Compare commits
2 Commits
d554b6f1fb
...
425d7766f0
Author | SHA1 | Date | |
---|---|---|---|
|
425d7766f0 | ||
|
23819baea7 |
@ -8,19 +8,22 @@
|
|||||||
This script creates events across -
|
This script creates events across -
|
||||||
1. [Google Calendar](https://developersindia.in/events-calendar/)
|
1. [Google Calendar](https://developersindia.in/events-calendar/)
|
||||||
2. [Discord](https://discord.com/channels/669880381649977354/)
|
2. [Discord](https://discord.com/channels/669880381649977354/)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### FIRST TIME SETUP
|
### FIRST TIME SETUP
|
||||||
|
|
||||||
1. Get Python3 `sudo apt-get install python3 && python3 --version`
|
1. Get Python3 `sudo apt-get install python3 && python3 --version`
|
||||||
|
|
||||||
2. Install required packages `pip install -r packages.txt`
|
2. Install required packages `pip install -r requirements.txt`
|
||||||
|
|
||||||
3. Add respective tokens in the `.env` file
|
3. Add respective tokens in the `.env` file
|
||||||
|
|
||||||
3.1 Discord Bot token (Get it from [Discord Developers portal](https://discord.com/developers/applications/)) (bot must have MANAGE_EVENT & CREATE_EVENT permission)
|
3.1 Discord Bot token [`DISCORD_BOT_TOKEN`] (Get it from [Discord Developers portal](https://discord.com/developers/applications/)) (bot must have MANAGE_EVENT & CREATE_EVENT permission)
|
||||||
|
|
||||||
3.2 Guild ID (developersIndia => 1229786646468362260)
|
3.2 Guild ID [`DISCORD_GUILD_ID`] (developersIndia => `1229786646468362260`)
|
||||||
|
|
||||||
|
3.3 Calender Id [`GOOGLE_CALENDER_ID`] (developerIndia => `9f1337e4154910eb1bdb3bfac32b88f69546468b1281a6db58f50a909df5049f@group.calendar.google.com`)
|
||||||
|
|
||||||
4. Connect Google Calender through [Google cloud Console](https://console.cloud.google.com/)
|
4. Connect Google Calender through [Google cloud Console](https://console.cloud.google.com/)
|
||||||
|
|
@ -1,11 +1,16 @@
|
|||||||
import os.path
|
import os.path
|
||||||
import event_details as main
|
import event_details as main
|
||||||
|
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
from google.auth.transport.requests import Request
|
from google.auth.transport.requests import Request
|
||||||
from google.oauth2.credentials import Credentials
|
from google.oauth2.credentials import Credentials
|
||||||
from google_auth_oauthlib.flow import InstalledAppFlow
|
from google_auth_oauthlib.flow import InstalledAppFlow
|
||||||
from googleapiclient.discovery import build
|
from googleapiclient.discovery import build
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
calendar_id = os.getenv('GOOGLE_CALENDAR_ID')
|
||||||
|
|
||||||
SCOPES = ['https://www.googleapis.com/auth/calendar']
|
SCOPES = ['https://www.googleapis.com/auth/calendar']
|
||||||
|
|
||||||
def create_event(name, description, location, date, start_time, end_time):
|
def create_event(name, description, location, date, start_time, end_time):
|
||||||
@ -47,7 +52,7 @@ def create_event(name, description, location, date, start_time, end_time):
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
event = service.events().insert(calendarId='primary', body=event).execute()
|
event = service.events().insert(calendarId=calendar_id, body=event).execute()
|
||||||
|
|
||||||
print('Google Calender: %s' % (event.get('htmlLink')))
|
print('Google Calender: %s' % (event.get('htmlLink')))
|
||||||
return event
|
return event
|
@ -6,7 +6,16 @@
|
|||||||
|
|
||||||
DISCORD_BOT_TOKEN = "TOKEN"
|
DISCORD_BOT_TOKEN = "TOKEN"
|
||||||
|
|
||||||
|
# -----------
|
||||||
|
|
||||||
# DISCORD SERVER ID (GUILD ID)
|
# DISCORD SERVER ID (GUILD ID)
|
||||||
# developersIndia => 1229786646468362260
|
# developersIndia => 1229786646468362260
|
||||||
|
|
||||||
DISCORD_GUILD_ID = 1229786646468362260
|
DISCORD_GUILD_ID = 1229786646468362260
|
||||||
|
|
||||||
|
# -----------
|
||||||
|
|
||||||
|
# CALANDER ID
|
||||||
|
# developersIndia => "9f1337e4154910eb1bdb3bfac32b88f69546468b1281a6db58f50a909df5049f@group.calendar.google.com"
|
||||||
|
|
||||||
|
GOOGLE_CALENDAR_ID = "9f1337e4154910eb1bdb3bfac32b88f69546468b1281a6db58f50a909df5049f@group.calendar.google.com"
|
Loading…
Reference in New Issue
Block a user