Z
Z
Zenet1212122021-09-12 12:13:27
Python
Zenet121212, 2021-09-12 12:13:27

What to do with requests what is wrong here and how to fix the code for discord.py?

hello tell me what to do

@bot.command()
async def online(self, ctx):
    r = requests.get('https://api.vimeworld.ru/online', headers)
    headers["separated": "fallguys"]
    r.json()
    await ctx.send.r()

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Gornostaev, 2021-09-12
@sergey-gornostaev

Read a Python tutorial before getting into bots. Judging by the question, you don't even know the basics.

N
Nikita Mokhovikov, 2021-09-12
@mohovoy

Try this

@bot.command()
async def online(self, ctx):
    headers = {
        "separated": "fallguys"
    }
    r = requests.get('https://api.vimeworld.ru/online', headers=headers)
    await ctx.send(r.json())

S
s4q, 2021-09-12
@s4q

Read, please, some book on Python.

@bot.command()
async def online(self, ctx):
    r = requests.get('https://api.vimeworld.ru/online').json()['separated']['fallguys']
    await ctx.send(r)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question