mirror of
https://github.com/yawaflua/Flask-Discord.git
synced 2026-02-04 10:14:15 +02:00
Improve the stuffs
This commit is contained in:
@@ -50,7 +50,7 @@ intersphinx_mapping = {
|
||||
'discord': ('https://discordpy.readthedocs.io/en/latest/', None),
|
||||
'quart': ('https://pgjones.gitlab.io/quart/', None),
|
||||
'cachetools': ('https://cachetools.readthedocs.io/en/stable/', None),
|
||||
'requests_oauthlib': ('https://requests-oauthlib.readthedocs.io/en/latest/', None)
|
||||
'async_oauthlib': ('https://async-oauthlib.readthedocs.io/en/latest/', None)
|
||||
}
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
|
||||
@@ -65,25 +65,25 @@ in exchange for fetching user's details and display them on web page.
|
||||
|
||||
|
||||
@app.route("/login/")
|
||||
def login():
|
||||
return discord.create_session()
|
||||
async def login():
|
||||
return await discord.create_session()
|
||||
|
||||
|
||||
@app.route("/callback/")
|
||||
def callback():
|
||||
discord.callback()
|
||||
async def callback():
|
||||
await discord.callback()
|
||||
return redirect(url_for(".me"))
|
||||
|
||||
|
||||
@app.errorhandler(Unauthorized)
|
||||
def redirect_unauthorized(e):
|
||||
async def redirect_unauthorized(e):
|
||||
return redirect(url_for("login"))
|
||||
|
||||
|
||||
@app.route("/me/")
|
||||
@requires_authorization
|
||||
def me():
|
||||
user = discord.fetch_user()
|
||||
async def me():
|
||||
user = await discord.fetch_user()
|
||||
return f"""
|
||||
<html>
|
||||
<head>
|
||||
|
||||
Reference in New Issue
Block a user