mirror of
https://github.com/yawaflua/Flask-Discord.git
synced 2025-12-10 12:29:30 +02:00
change small type for function and import os
This commit is contained in:
@@ -47,6 +47,7 @@ in exchange for fetching user's details and display them on web page.
|
|||||||
|
|
||||||
|
|
||||||
.. code-block:: python3
|
.. code-block:: python3
|
||||||
|
import os
|
||||||
|
|
||||||
from flask import Flask, redirect, url_for
|
from flask import Flask, redirect, url_for
|
||||||
from flask_discord import DiscordOAuth2Session, requires_authorization, Unauthorized
|
from flask_discord import DiscordOAuth2Session, requires_authorization, Unauthorized
|
||||||
@@ -66,10 +67,10 @@ in exchange for fetching user's details and display them on web page.
|
|||||||
discord = DiscordOAuth2Session(app)
|
discord = DiscordOAuth2Session(app)
|
||||||
|
|
||||||
def welcome_user(user):
|
def welcome_user(user):
|
||||||
dm_channel = discord.bot_request("/users/@me/channels", "POST", json={"recipient_id": user.id})
|
dm_channel = discord.bot_request("/users/@me/channels", "POST", json={"recipient_id": user.id})
|
||||||
return discord.bot_request(
|
return discord.bot_request(
|
||||||
f"/channels/{dm_channel['id']}/messages", "POST", json={"content": "Thanks for authorizing the app!"}
|
f"/channels/{dm_channel['id']}/messages", "POST", json={"content": "Thanks for authorizing the app!"}
|
||||||
)
|
)
|
||||||
|
|
||||||
@app.route("/login/")
|
@app.route("/login/")
|
||||||
def login():
|
def login():
|
||||||
|
|||||||
Reference in New Issue
Block a user