joke

package
v0.0.0-...-ada7983 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheJoke

func CacheJoke(rdb *redis.Client, joke *Joke) error

Saves a joke to the cache and the DB

func GenerateJoke

func GenerateJoke(client *openai.Client) (string, error)

Generates a joke using OpenAI's GPT-3 API

func IsSimilarJoke

func IsSimilarJoke(joke1, joke2 string) bool

Checks if a joke is similar to an existing joke

func SaveJoke

func SaveJoke(jokesCollection *mongo.Collection, joke *Joke) error

Saves a joke to the database

Types

type Joke

type Joke struct {
	ID   string
	Text string
}

Joke represents a joke

func GetRandomJoke

func GetRandomJoke(jokesCollection *mongo.Collection, rdb *redis.Client) (Joke, error)

Returns a random joke from the database

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL