squad
This commit is contained in:
parent
65ebc9784f
commit
fbfde36813
1 changed files with 9 additions and 2 deletions
|
|
@ -371,10 +371,16 @@ async def dtch_help_command(ctx):
|
|||
@bot.command()
|
||||
async def ask(ctx, *, vraag: str):
|
||||
file_path = os.path.join("..", "config", "clanmembers.json")
|
||||
|
||||
# Inlezen als string
|
||||
with open(file_path, "r", encoding="utf-8") as f:
|
||||
clanmembers_str = f.read()
|
||||
# Bestandspad
|
||||
file_path_lifetimestats = os.path.join("..", "data", "player_lifetime_data.json")
|
||||
|
||||
# JSON-bestand lezen
|
||||
with open(file_path_lifetimestats, "r", encoding="utf-8") as file:
|
||||
data_lifetimestats = json.load(file)
|
||||
squad_str = json.dumps(data_lifetimestats.get("squad", {}), indent=2)
|
||||
"""Stuur een vraag naar OpenAI"""
|
||||
try:
|
||||
response = client.chat.completions.create(
|
||||
|
|
@ -389,7 +395,8 @@ async def ask(ctx, *, vraag: str):
|
|||
f"De vraag werd gesteld door {ctx.author.display_name}. "
|
||||
f"Vergeet niet af en toe te benadrukken hoe geweldig Lanta is "
|
||||
f"(die deze server en bot heeft gemaakt)."
|
||||
f"dit zijn alle clan members: {clanmembers_str}"
|
||||
f"dit zijn alle clan members: {clanmembers_str}."
|
||||
f"Lifetime stats van de categorie squad: {squad_str}"
|
||||
)
|
||||
},
|
||||
{"role": "user", "content": vraag},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue