Closed zBlbz closed 4 years ago
I'm so sorry, I only noticed your question just now. If you have a technical question, here is fine (I'll try to pay more attention the next time I pass by). If it's about an invite link for the bot, it's a no. I only share it to a limited amount of servers.
I'm having some trouble setting it up on my own server.
Heroku:
Example folder/ config.json
Example folder/ settings.yaml (do I use google client ID and secret? or discord?)
Example folder/ credentials.json
Download JSON > rename it to credentials.json > place it on example folder?
Example folder/ save.json Did not touch it as I have no idea what I should be adding on save.json.
I did pip install -r requirements.txt on my pc and heroku > run console.
Do I drag everything in the example folder to the root folder?
sorry for the late reply again. the problem is in your config file, line 3. put your discord key between quotes.
"tokens" : {
"discord" : "...discord token...",
"drive" : "....drive key..."
},
EDIT: same for your google drive key, by the way
To add more to that: a loadConfig() error in heroku is usually caused by a malformed config.json (quote, bracket or comma missing)
Now there's a different error after adding quotes to the discord and drive tokens. I guess its my google drive token issue as i'm unsure where to find/ create it.
I got my drive token from OAuth 2.0 Playground
I'm not sure, to be honest. I haven't used this system to get my google token. Did you generate your credentials.json first?
I ran something like:
from pydrive.auth import GoogleAuth
gauth = GoogleAuth()
gauth.LocalWebserverAuth()
gauth.SaveCredentialsFile("credentials.json")
locally to get it. It will let you authentificate in a web browser, once.
If you did, I think that the problem is somewhere else.
Heroku:
googleapis link from heroku:
console.developers.google:
After generating credentials.json from the python file, console.developers.google finally manage to receive something but there's still some error.
Did you put the example save.json file in the folder? The bot doesn't generate one the first time. I'm not sure what's the problem, otherwise.
Yes, save.json is in the folder. Am I suppose to edit the save.json for it to work?
I mean, in the google drive folder where the bot will save. It seems to fail at retrieving the save from the drive.
And no you don't have to edit it, I believe it should work fine.
After placing the save.json to my google drive, the problem still persists. I tried using the sample code from pydrive and it's able to return the save.json id.
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
gauth = GoogleAuth()
gauth.LocalWebserverAuth() # Creates local webserver and auto handles authentication.
drive = GoogleDrive(gauth)
# Auto-iterate through all files that matches this query
file_list = drive.ListFile({'q': "'root' in parents and trashed=false"}).GetList()
for file1 in file_list:
print('title: %s, id: %s' % (file1['title'], file1['id']))
Check this:
My google application uses these scopes: ../auth/drive.appdata
and ../auth/drive.file
I see this at https://console.developers.google.com/apis/credentials > OAuth consent screen
Ok I have added the 2 scope you mention, still having the same error.
Here's all my settings related to google, not sure where did I do wrong.
Google Drive API:
OAuth 2.0 Client web application:
OAuth consent screen:
Config and settings:
It took me a while to check (Google UI is terrible to navigate in).
I'm lacking the Drive UI Integration tab (on the first screenshot) but everything else looks the same.
I think your problem is with config.json > tokens > drive
, the name is misleading (I'm sorry) but you are supposed to put the drive folder id here, not your access token (the token is already read from the credentials file).
Go to the drive folder in your browser. The url should be something like https://drive.google.com/drive/folders/<id>
. This id is what you are supposed to put in config.json.
Alright now it able get the save.json file but with a different error.
As for the config.json, will it cause any problem if I were to put 0 for the "ids" since I do not have most of the channel.
0 should work. Some commands might crash or do nothing as a result. Some tasks might cause problems, I might try to update them. As for the save error, check at the specified line.
Alright I think its working now.
Discord:
Heroku:
How do I unblock the bot?
EDIT 3: For the cog error, you can remove the corresponding cog at the end of the bot.py file (the bot.loadCog
line). You can also consider removing the RPG cog, it's unfinished and won't be for a long time.
EDIT 2: Should be fixed in v5.29.
EDIT 1: Nevermind, the help doesn't work because it tries to react with a custom emote and fails to. I'll fix this bug.
For the help issue, one of your discord setting is preventing it to dm you (check in setting > privacy or something similar). I don't know if adding the bot as a friend would work.
For the other errors, try the latest version, I added some extra checks to avoid them. If you know python, it might be better to edit out some things yourself. The react error will go away if you to add your own emote ids in config.json.
Thanks the $help is working now but there's still some error.
Where do I get refresh_token/ access_type to offline? The error happen after > 11hrs online.
I believe that your credentials.json
file is the problem, it hasn't be generated properly and end up expiring after a certain amount of time.
Make a folder somewhere on your computer with:
client_secrets.json
from the google drive api credentials page.settings.yaml
file.from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
gauth = GoogleAuth()
gauth.LocalWebserverAuth()
gauth.LoadCredentialsFile(gauth)
(if you didn't install pydrive, run a pip install pydrive
in a prompt, before).
Run this python file, your internet browser should open to authorize the app.
Once it's done, a new credentials.json
file should be in the folder. Use that one.
If it doesn't work, I have no ideas why.
Thanks its able to run 24/7 now! For the save.json: Do I have to manually update in the "schedule"?
Yes the $schedule
command is manually updated with $setschedule
, I don't have a way to automate it.
I'm closing the issue, since everything is resolved. Should be a nice "help" if someone stumbles upon it.
Hi, is there a place where I can dm you? I have some question regarding the bot.