Answer the question
In order to leave comments, you need to log in
How to read and display messages from a bot using Flask and discord.py?
The bot sends a generated link to the user's LAN to connect to a private room, how can I display this link to the site using a flask?
Here is the output code on the username and tag on the flask
@app.route('/login', methods=["get"])
def login():
code = request.args.get("code")
at = Oauth.get_access_token(code)
user_json = Oauth.get_user_json(at)
username, usertag = user_json.get("username"), user_json.get("discriminator")
return f"{username}#{usertag}"
@Bot.event
async def on_voice_state_update(member, before, after):
if after.channel.id == #:
for guild in Bot.guilds:
maincategory = discord.utils.get(guild.categories, id=#)
channel = await guild.create_voice_channel(name=f'{member.display_name}', category=maincategory)
await channel.set_permissions(member, connect=True, mute_members=True, move_members=True,
manage_channels=True)
await member.move_to(channel)
await channel.create_invite()
url_channel = await channel.invites()
await member.send('https://discord.gg/' + url_channel[0].code)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question