Open zacholade opened 5 years ago
Edit. There is a verification system in place and the riotwatcher wrapper has been speedy to implement this. (It was literally just implemented haha)
Ignoring exception in on_ready
Traceback (most recent call last):
File "/home/zachy/.local/lib/python3.6/site-packages/discord/client.py", line 220, in _run_event
await coro(*args, **kwargs)
File "bot.py", line 84, in on_ready
profile = await user.profile()
File "/home/zachy/.local/lib/python3.6/site-packages/discord/user.py", line 600, in profile
data = await state.http.get_user_profile(self.id)
File "/home/zachy/.local/lib/python3.6/site-packages/discord/http.py", line 210, in request
raise Forbidden(r, data)
discord.errors.Forbidden: FORBIDDEN (status code: 403): Bots cannot use this endpoint
Well turns out this idea is down the drain.
https://discordpy.readthedocs.io/en/rewrite/api.html#discord.User.profile
https://discordapp.com/developers/docs/topics/oauth2 Nevermind.. It is possible to authorise the bot via oauth2 however I think this should come in a later release due to the strenuous efforts needed to implement oauth2 code for token grant. discord.py library does not have oauth2 support and we would need to implement this ourselves.
Pog idea but we can wait.
Idea implemented in https://github.com/Zachy24/Rift-Companion/commit/854b69e71f5f9884df1be1d57e58ecfdb14bfbdb:
TODO:
[ ] Implement state in the authorization url:
# TODO Implement state. Security vulnerability.
# https://discordapp.com/developers/docs/topics/oauth2#state-and-security
# Supply state in args of the oauth2 request eg: &state=15773059ghq9183habn
# Check to see if the returned state in the callback is equal to the one sent.
# This state needs to be unique to the user. Issues happen when the user calls
# the 'iam' command to link. If other users use the same oauth2 link, they will
# have the wrong state and an error will be thrown.
[ ] Don't hard code the invite url in the oauth2 link commands.
[ ] Store the token exchanged for the code received after oauth2 so that we can use it / refresh it in the future.
[x] Store connections to disk when shutting down the bot and on interval.
https://discussion.developer.riotgames.com/questions/6153/oauth-for-league-of-legends-account.html
"We're are actively working on an OAuth solution for third party developers but we don't have an ETA on when that work will be completely/ready for use. There will be an announcement when we've got more to share, you can follow announcements here either on our forums or via Twitter."
When implemented, we will investigate adding this to the bot instead of a simple "iam" command.