dolphin

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

README

Dolphin-Send

This program continually tails a log file and sends the desired messages to the Dolphin bot (or technically where ever you want) via HTTP as JSON messages.

Report License

Building

Dolphin has a Makefile to make building and installing easier.

To build the project, run make. To check the project and run tests, run make check.

Installation

You can install the latest release without cloning and building by using go get github.com/EbonJaeger/dolphin-send. If you clone the project and want to install it that way, you can run make install which just runs go install ./cmd/dolphin-send.

Usage

./dolphin-send [OPTIONS]

Options:

-a, --address  - The address of the listening server to send to
    --debug    - Print additional debug lines to stdout
-h, --help     - Print the help message
-k, --keywords - Comma-separated list of words to use as additional death keywords to look for
-l, --log      - The location of the log file to read
-p, --port     - The port number of the listening server

License

Copyright © 2020 Evan Maddock (EbonJaeger)
Makefile adapted from usysconf, which is a Solus Project

Dolphin-Send is available under the terms of the Apache-2.0 license

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageSource

type MessageSource string

MessageSource is the source of a Minecraft message, either a player or the server.

const (
	// PlayerSource indicates that a message came from a player, e.g.
	// a chat message.
	PlayerSource MessageSource = "Player"
	// ServerSource indicates that a message came from the server,
	// such as when a player joins.
	ServerSource MessageSource = "Server"
)

type MinecraftMessage

type MinecraftMessage struct {
	Username string        `json:"name"`
	Content  string        `json:"content"`
	Source   MessageSource `json:"source"`
	UUID     string        `json:"uuid"`
}

MinecraftMessage represents a message from Minecraft to be sent to Discord.

type MinecraftWatcher

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

MinecraftWatcher watches for log lines from a Minecraft server.

func NewWatcher

func NewWatcher(path string, logger *waterlog.WaterLog, customDeathKeywords []string) *MinecraftWatcher

NewWatcher creates a new watcher with all of the Minecraft death message keywords.

func (*MinecraftWatcher) Close

func (w *MinecraftWatcher) Close() error

Close stops the tail process and cleans up inotify file watches.

func (MinecraftWatcher) GetUUID added in v1.1.0

func (w MinecraftWatcher) GetUUID(name string) (uuid string, ok bool)

GetUUID returns a UUID if present in the cache. See docs for Go maps. This is only meant to be used as a testing helper function.

func (*MinecraftWatcher) ParseLine

func (w *MinecraftWatcher) ParseLine(line string) *MinecraftMessage

ParseLine parses a log line for various types of messages and returns a MinecraftMessage struct if it is a message we care about.

func (*MinecraftWatcher) Watch

func (w *MinecraftWatcher) Watch(c chan<- *MinecraftMessage)

Watch watches a log file for changes and sends Minecraft messages to the given channel.

Directories

Path Synopsis
cmd
dolphin-send command

Jump to

Keyboard shortcuts

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