fix(seautils): fixed only the first A response being used
This commit is contained in:
parent
fb468ee63e
commit
8608e6a34e
1 changed files with 25 additions and 11 deletions
|
@ -128,19 +128,33 @@ class SeaUtils(commands.Cog):
|
||||||
embed.colour = Color.red()
|
embed.colour = Color.red()
|
||||||
embed.description = cf.error("Dig query did not return `NOERROR` status.")
|
embed.description = cf.error("Dig query did not return `NOERROR` status.")
|
||||||
|
|
||||||
question_section = "\n".join(response_data['QUESTION_SECTION'])
|
questions = []
|
||||||
embed.add_field(name="Question Section", value=f"```{question_section}```", inline=False)
|
answers = []
|
||||||
|
authorities = []
|
||||||
|
for m in data:
|
||||||
|
response = m['message']['response_message_data']
|
||||||
|
if 'QUESTION_SECTION' in response:
|
||||||
|
for question in response['QUESTION_SECTION']:
|
||||||
|
questions.append(question)
|
||||||
|
if 'ANSWER_SECTION' in response:
|
||||||
|
for answer in response['ANSWER_SECTION']:
|
||||||
|
answers.append(answer)
|
||||||
|
if 'AUTHORITY_SECTION' in response:
|
||||||
|
for authority in response['AUTHORITY_SECTION']:
|
||||||
|
authorities.append(authority)
|
||||||
|
|
||||||
if 'ANSWER_SECTION' in response_data:
|
question_section = "\n".join(questions)
|
||||||
answer_section = "\n".join(response_data['ANSWER_SECTION'])
|
embed.add_field(name="Question Section", value=f"{cf.box(question_section)}", inline=False)
|
||||||
if len(answer_section) > 1024:
|
|
||||||
embed.description = answer_section
|
|
||||||
else:
|
|
||||||
embed.add_field(name="Answer Section", value=f"```{answer_section}```", inline=False)
|
|
||||||
|
|
||||||
if 'AUTHORITY_SECTION' in response_data:
|
answer_section = "\n".join(answers)
|
||||||
authority_section = "\n".join(response_data['AUTHORITY_SECTION'])
|
if len(answer_section) > 1024:
|
||||||
embed.add_field(name="Authority Section", value=f"```{authority_section}```", inline=False)
|
embed.description = cf.warning("Answer section is too long to fit within embed field, falling back to description.") + cf.box(answer_section)
|
||||||
|
else:
|
||||||
|
embed.add_field(name="Answer Section", value=f"{cf.box(answer_section)}", inline=False)
|
||||||
|
|
||||||
|
if authorities:
|
||||||
|
authority_section = "\n".join(authorities)
|
||||||
|
embed.add_field(name="Authority Section", value=f"{cf.box(authority_section)}", inline=False)
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
else:
|
else:
|
||||||
await ctx.send(content=cf.box(text=stdout, lang='yaml'))
|
await ctx.send(content=cf.box(text=stdout, lang='yaml'))
|
||||||
|
|
Loading…
Reference in a new issue