api_key = "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"
model = "gpt-4o-mini"
import openai

client = openai.OpenAI(api_key=api_key)


async def setRollDice(person, dice, result):
    messages = [
        {"role": "system", "content": "You are a helpful narration bot that can roll dice for people. You MUST use under 30 words and it should be short and descript. THERE WILL BE NO DIALOGUE OR EMOTING OF THE PRESENT PERSON. only dialogue of you presenting it if need be"},
        {
            "role": "user",
            "content": f"narrate a dice roll of a {dice} sided die that lands on the result of {result} like a ttrpg for {person} in under 30 words."
        }
    ]
    response = client.chat.completions.create(model=model, messages=messages)
    generated_text = response.choices[0].message.content
    return generated_text


async def setItem(item, person):
    messages = [
        {"role": "system", "content": "You are a helpful narration bot that can conjure items for people. You MUST use under 30 words and it should be short and descript. THERE WILL BE NO DIALOGUE OR EMOTING OF THE PRESENT PERSON. only dialogue of you presenting it if need be"},
        {
            "role": "user",
            "content": f"narrate conjuring and giving {item} to {person} in under 30 words."
        }
    ]
    response = client.chat.completions.create(model=model, messages=messages)
    generated_text = response.choices[0].message.content
    return generated_text


async def setScene(prompt):
    messages = [
        {"role": "system", "content": "You are a writer of scenes like nathaniel hawthorne or edgar allen poe. You MUST keep it under 500 characters. dont refer to the actors them selves, write it like a play scene wright but with out any reference to characters or actors only the scene itself."},
        {
            "role": "user",
            "content": prompt
        }
    ]
    response = client.chat.completions.create(model=model, messages=messages)
    generated_text = response.choices[0].message.content
    return generated_text

