- Python 3.8 or higher
- Discord.py v2.3.2
- Google API
pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
git clone https://github.com/Army-py/OgameBot
cd OgameBot
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r requirements.txt
- Create a Discord bot here
- Fill in the
bot_config/secret.json
file with the token of your bot - Fill in the
bot_config/sheet.json
file with the ID of your Google Sheet file - Execute the
bot.py
file with Python 3.8 or higher (python bot.py
)
- To use Google APIs, you need to create a service account.
- To do this, go to this page and select the project you want to use, or create a new one.
- Then click on
Create credentials
and thenService account
. - You can then choose the name of the service account.
- Then click on
Create and continue
. - On the next page, you can choose the roles of the service account.
- For this project, you need to choose
Project
thenOwner
,Editor
, andViewer
. - Then click on
Continue
.
- To obtain a key, which will be in a .json file, go to the interface of the service account you want to use.
- Then go to
Keys
in the top bar, thenAdd key
and finallyCreate key
. - You will then choose
JSON
as the key type, and you will get a .json file. - Then place this file in the
bot_config
folder located in the root of the project, and rename it tocredentials.json
. - Remove the line which contains
"universe_domain": "googleapis.com"
, otherwise you will get an error. (Don't forget to remove the comma from the previous line too).
- To use Google Sheet APIs, you will need to enable them.
- To do this, go to this page and select the project you want to use, or create a new one.
- Then click on
Enable
.
- To use Google Sheet APIs, you will need to create a Google Sheet file beforehand.
- To do this, go to this page and click on
New
thenGoogle Sheets
. - You can then choose the name of the file.
- Retrieve the email address of the service account you created earlier, in the service account interface.
- Then go to the Google Sheet file you created, and click on
Share
in the top right corner. - Paste the email address of the service account into the search bar, and select the appropriate rights.
- You can then retrieve the ID of the Google Sheet file in the file's URL. It is the string of characters after
/d/
and before/edit
. - You can then place the file ID in the
bot_config/sheet.json
file.