- 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/OgameBotcd OgameBotpython3 -m venv .venvsource .venv/bin/activatepython3 -m pip install -r requirements.txt
- Create a Discord bot here
- Fill in the
bot_config/secret.jsonfile with the token of your bot - Fill in the
bot_config/sheet.jsonfile with the ID of your Google Sheet file - Execute the
bot.pyfile 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 credentialsand 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
ProjectthenOwner,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
Keysin the top bar, thenAdd keyand finallyCreate key. - You will then choose
JSONas the key type, and you will get a .json file. - Then place this file in the
bot_configfolder 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
NewthenGoogle 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
Sharein 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.jsonfile.