/humano

Humano is a message replier for adam that immitates human typing by adding delays in between messages.

Primary LanguageGoMIT LicenseMIT

humano

Go Reference GitHub Workflow Status (branch) Go Report Card License


About

Humano is a small utility for adam, that allows you to imitate typing, by delaying messages.

Example

package main

import (
	"log"
	"os"
	"os/signal"

	"github.com/mavolin/adam/pkg/bot"

	"github.com/mavolin/humano/pkg/replier"
)

func main() {
	b, err := bot.New(bot.Options{
		Token: os.Getenv("DISCORD_BOT_TOKEN"),
	})
	if err != nil {
		log.Fatal(err)
	}

	b.MustAddMiddleware(replier.NewMiddleware(&replier.Options{}))

	// add commands

	if err := b.Open(); err != nil {
		log.Fatal(err)
	}

	sig := make(chan os.Signal, 1)
	signal.Notify(sig, os.Interrupt)

	<-sig

	if err := b.Close(); err != nil {
		log.Fatal(err)
	}
}
package mycommand

...

func (c *MyCommand) Invoke(s *state.State, ctx *plugin.Context) (interface{}, error) {
	_, err := replier.Reply(ctx, "Wumpus!")
	return nil, err
}