goMuffin/chatbot/prompt.go
2025-06-05 22:45:08 +09:00

34 lines
774 B
Go

package chatbot
import (
"fmt"
"os"
"git.wh64.net/muffin/goMuffin/configs"
"github.com/bwmarrin/discordgo"
)
func loadPrompt() (string, error) {
bin, err := os.ReadFile(configs.Config.Chatbot.Gemini.PromptPath)
if err != nil {
return "", err
}
return string(bin), nil
}
func makePrompt(systemPrompt string, user *discordgo.User) string {
if user.ID == configs.Config.Bot.OwnerId {
return fmt.Sprintf(systemPrompt, fmt.Sprintf(
"## User Information\n* **ID:** %s\n* **Name:** %s\n* **Other:** This user is your developer.",
user.ID,
user.GlobalName,
))
}
return fmt.Sprintf(systemPrompt, fmt.Sprintf(
"## User Information\n* **ID:** %s\n* **Name:** %s\n* **Other:** This user is **not** your developer.",
user.ID,
user.GlobalName,
))
}