mirror of
https://github.com/yawaflua/Flask-Discord.git
synced 2025-12-09 20:09:30 +02:00
Fixed tabs
This commit is contained in:
34
README.md
34
README.md
@@ -17,9 +17,9 @@ from flask import Flask, redirect, url_for
|
|||||||
from flask_discord import DiscordOAuth2Session
|
from flask_discord import DiscordOAuth2Session
|
||||||
|
|
||||||
CONFIGS = {
|
CONFIGS = {
|
||||||
"client_id": 9999999999,
|
"client_id": 9999999999,
|
||||||
"client_secret": "your client secret",
|
"client_secret": "your client secret",
|
||||||
"redirect_uri": "default redirect uri",
|
"redirect_uri": "default redirect uri",
|
||||||
}
|
}
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
@@ -29,28 +29,28 @@ discord = DiscordOAuth2Session(**CONFIGS)
|
|||||||
|
|
||||||
@app.route("/login")
|
@app.route("/login")
|
||||||
def login():
|
def login():
|
||||||
return discord.create_session()
|
return discord.create_session()
|
||||||
|
|
||||||
|
|
||||||
@app.route("/callback")
|
@app.route("/callback")
|
||||||
def callback():
|
def callback():
|
||||||
discord.callback()
|
discord.callback()
|
||||||
return redirect(url_for(".me"))
|
return redirect(url_for(".me"))
|
||||||
|
|
||||||
|
|
||||||
@app.route("/me")
|
@app.route("/me")
|
||||||
def me():
|
def me():
|
||||||
user = discord.fetch_user()
|
user = discord.fetch_user()
|
||||||
return f"""
|
return f"""
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>{user.name}</title>
|
<title>{user.name}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<img src='{user.avatar_url}' />
|
<img src='{user.avatar_url}' />
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user