Skip to content

Instantly share code, notes, and snippets.

View cmdwm's full-sized avatar
👋
Hello World

Will M cmdwm

👋
Hello World
View GitHub Profile
@cmdwm
cmdwm / gpt-reply.js
Last active April 10, 2023 01:50
The code we use to fetch and return ChatGPT responses with a custom prompt. This code has been simplified to be user friendly from what is currently used at WowAgent. We do not and will not provide official support for this code, and it may become outdated. Use at your own risk, no warranty is given or implied.
var options = {
'method': 'POST',
'url': 'https://api.openai.com/v1/chat/completions',
'headers': {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': process.env.openAiKey
},
body: JSON.stringify({
"model": "gpt-3.5-turbo",
{channel} - current channel mention
{channel.name} - current channel name
{server} - current server name
{server.membercount} - current server member count
{user} - mention user calling command
{user.name} user's username (no mention)
$N - use args