core

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: Unlicense Imports: 4 Imported by: 0

README

Sackbot

This is the "core" component of Sackbot that makes it slightly simpler to write plugins/sub-bots (TODO: terminology...)

The ideal way to use this is (very roughly) like this:

package main

import (
	"log"
	"github.com/ergochat/irc-go/ircmsg"
	bot "git.actionsack.com/xnaas/sackbot-core"
)

func registerPlugin(irc *bot.Bot) {
	irc.AddCallback("PRIVMSG", func(e irmsg.Message) {
		target, msg := e.Params[0], e.Params[1]
		if msg == "test" {
			irc.Privmsg(target, "Test successful!")
		}
	})
	log.Println("PluginName loaded.")
}

func main() {
	irc := bot.MkBot("OwnerNick", false, "v0.0.1")
	registerPlugin(irc)
	err := irc.Connect()
	if err != nil {
		log.Fatal(err)
	}
	irc.Loop()
}

Documentation

Overview

Authors: xnaas <me@xnaas.info> (2023) License: The Unlicense (public domain)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromOwner

func FromOwner(e ircmsg.Message, owner string) bool

Check if the person running a command/trigger is the bot owner.

Types

type Bot

type Bot struct {
	ircevent.Connection
	Owner string
}

What *is* a "Bot"?

func MkBot

func MkBot(trunc bool) *Bot

Make a "Bot" :: requires truncation policy

Jump to

Keyboard shortcuts

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