humano

module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2021 License: MIT

README

humano

Go Reference GitHub Workflow Status (branch) codecov 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
}

Directories

Path Synopsis
pkg
replier
Package replier provides the delayed replier.
Package replier provides the delayed replier.

Jump to

Keyboard shortcuts

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