relay

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: BSD-3-Clause Imports: 1 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Date   time.Time // Time
	Source bool      // IRC (false) or TG (true)
	Nick   string    // Nickname in both IRC and Telegram
	Text   string

	ID        int    // Message ID, Telegram only
	FromID    int    // From user ID, Telegram only
	FirstName string // Realname, Telegram only
	LastName  string // Realname, Telegram only

	// In IRC: CTCP (ACTION), kick, topic
	// In Telegram: medias, replies, forwards, pins, edits, new/left members...
	Extra map[string]string
}

Message represents a generic message which may be either from TG or IRC.

func (*Message) Name

func (message *Message) Name() (nick string)

Name returns string representation of the sender.

type Relay

type Relay struct {
	TeleCh        chan Message
	TeleServiceCh chan ServiceMessage
	IRCh          chan Message
	IRCServiceCh  chan ServiceMessage

	// used for messages that need to be
	// run even when IRC bot not in channel
	TeleAlwaysCh chan ServiceMessage
}

Relay contains channels used by goroutines to exchange messages.

func NewRelay

func NewRelay() *Relay

NewRelay creates a new Relay.

type ServiceMessage

type ServiceMessage struct {
	Command   string
	Arguments []string
}

ServiceMessage represents a service message, which is not relayed.

Jump to

Keyboard shortcuts

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