Ask coding questions

← Back to all posts
Why is this error occuring?
h
VulcanWM (2342)

So I'm making this bot that stores its data in repl-db, but I'm not an expert in repl-db and now don't know why this error is occuring. The error is the picture below.

I have attached the repl, but place in the code where the error is occuring is below. The place where the error starts from is in line 78.

The error:

@client.command()
async def prof(ctx):
    member1 = ctx.message.author
    member = str(member1)
    if member in await db.all():
      credits = str(await db.view(member))
      title = "Coins"
      
    else:
      credits = "You don't have an account. Do hi!setaccount to make an account."
      title = ":pensive:"
    embed = make_embed(title=member, desc="")
    embed.add_field(name=title, value=credits)
    await ctx.send(embed=embed)

Can somebody help me?
Thanks in advance.

Comments
hotnewtop
PattanAhmed (1397)

@VulcanWM Hi,
I got your problem.
To solve your error you must change the line of code where the error is commanding you to this = await db.all
It shouldn't be like this = await.all()

Hope this helps
Please mark my answer if this helps :)

VulcanWM (2342)

Now it's showing me this error:

@PattanAhmed

PattanAhmed (1397)

@VulcanWM Ok.

Check this website.
This website refers to your issue.
Please notice the change in the answer of this question on the above website.

If you thought it as a bug report it here

Hope this helps
Please mark my answer if this helps

PattanAhmed (1397)

@VulcanWM
A 400 means that the request was malformed. In other words, the data stream sent by the client to the server didn't follow the rules.

In the case of a REST API with a JSON payload, 400's are typically, and correctly I would say, used to indicate that the JSON is invalid in some way according to the API specification for the service.

By that logic, both the scenarios you provided should be 400's.

Imagine instead this was XML rather than JSON. In both cases, the XML would never pass schema validation--either because of an undefined element or an improper element value. That would be a bad request. Same deal here.
Hope this helps
Please mark my answer if this helps

VulcanWM (2342)

Ok, nice explanation, but what do I do to fix [email protected]

PattanAhmed (1397)

@VulcanWM Can you check this website and understand where the change occures: website.

If didn't work, ping me again
Hope this helps
Please mark my answer if this helps.

PattanAhmed (1397)

@VulcanWM Or try to read the solution part of this website
I think it may not benefit, But I think it can...
But don't miss the above website for your goodness.
Hope this helps

PattanAhmed (1397)

@VulcanWM Hope your problem solves fast.
Thanks...

PattanAhmed (1397)

@VulcanWM Welcome!
Hoping to see a happy ending to a sad starting of yours

CodingCactus (4192)

You need to do credit = str(await db.view(member))

VulcanWM (2342)

Man it’s still not working. @CodingCactus

CodingCactus (4192)

@VulcanWM well I'm just looking at your whole snippet seeing as you haven't given a line number

CodingCactus (4192)

@VulcanWM also what is the point of make_embed it seems completely redundant, just make an embed the normal way

VulcanWM (2342)

wdym normal way? The place where the error starts from is in line 78. @CodingCactus

CodingCactus (4192)

@VulcanWM tell me what line the error is on! Not the general section

CodingCactus (4192)

@VulcanWM
embed = discord.Embed(color=0x00ff00, title=‘plonk your title here’, description=‘plonk your description here’)

CodingCactus (4192)

@VulcanWM yeah it is await db.all not await.all()

VulcanWM (2342)

Now it's showing me this error:

@CodingCactus

CodingCactus (4192)

@VulcanWM would be a lot easier if you showed the actual error message rather than that thx

CodingCactus (4192)

@VulcanWM don't do desc="" when you make an embed, that is probably your error

VulcanWM (2342)

When I do that, it says that Command raised an exception: TypeError: make_embed() missing 1 required positional argument: 'desc' @CodingCactus

CodingCactus (4192)

@VulcanWM yeah because you are using a stupid function which isn't needed

CodingCactus (4192)

@VulcanWM just do

embed = discord.Embed(title='hi')
embed.add_field(name='i dunno', value='bye')
CodingCactus (4192)

@VulcanWM you have a completely redundant function called make_embed it is just stupid

VulcanWM (2342)

I used your code, and HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In embed.fields.0.value: This field is required came up @CodingCactus

VulcanWM (2342)

It says line 85. Below are two pictures of the error:

@CodingCactus

CodingCactus (4192)

@VulcanWM ok, so what I think is happening is the variable credits is empty, try printing it