Skip to content

Commit

Permalink
Replace projectName with underscores using a case-insensitive global …
Browse files Browse the repository at this point in the history
…regular expression
  • Loading branch information
dols-codes committed Jan 7, 2024
1 parent a574993 commit 21752df
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Classes/TriviaBot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,13 @@ Next question:`
throw new Error("Can't ask trivia question - no OpenAI API key")
}

const question = await this.model.call(
let question = await this.model.call(
`Generate a short, cryptic, poetic, vague, difficult riddle that has the answer: "${project.projectName}". It is VERY important that you DO NOT include the answer in your response. The project description is: "${project.description}"`
)

const regex = new RegExp(project.projectName, 'gi')
question = question.replaceAll(regex, '_____')

embed.setDescription(question)

return embed
Expand Down

0 comments on commit 21752df

Please sign in to comment.