gofm

package module
v0.0.0-...-2ea9722 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MIT Imports: 9 Imported by: 0

README

gofm

Gofm is a robot for missevan that supports chat powered by ChatGPT.

Features

  • Greet
  • Chat with ChatGPT

Install

compile from source
make -j`nproc`

Usage

run gofm
./bin/gofm --config=config.yaml
Chat with robot
// chat
@robot 给我讲个笑话

// reset chat context
@robot reset
Options
get missevan token
./bin/gofm token PHONE PASSWORD

Replace PHONE and PASSWORD with your priviate account.

help

You can run gofm -h to get more detailed information.

Contributing

PRs accepted.

Documentation

Index

Constants

View Source
const (
	AnonUser = "匿名大佬"
)
View Source
const (
	CommandReset = "reset"
)

Variables

This section is empty.

Functions

func MarshalConfig

func MarshalConfig(config Config) string

Types

type ChatMessage

type ChatMessage struct {
	User     string // who send the message
	Type     NewMessageType
	Mentiond string // @someone
	Content  string
}

func ParseChatMessage

func ParseChatMessage(msg missevan.FMMessage) (nm ChatMessage)

type Config

type Config struct {
	MissEvan MissEvanConfig `yaml:"missevan"`
	OpenAi   OpenAIConfig   `yaml:"openai"`
}

func UnmarshalConfig

func UnmarshalConfig(filename string) (Config, error)

type MissEvanConfig

type MissEvanConfig struct {
	Live  int    `yaml:"live"`
	Token string `yaml:"token"`
}

type NewMessageType

type NewMessageType int
const (
	CommonContent NewMessageType = iota
	MentiondContent
	MentiondCommand
)

type OpenAIConfig

type OpenAIConfig struct {
	Key   string `yaml:"key"`
	Proxy string `yaml:"proxy"`
}

type Robot

type Robot struct {
	// contains filtered or unexported fields
}

func NewRobot

func NewRobot(config Config) *Robot

func (*Robot) Run

func (r *Robot) Run() error

func (*Robot) Send

func (r *Robot) Send(msg string) error

Directories

Path Synopsis
cmd
gofm command
openai command
pkg

Jump to

Keyboard shortcuts

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