util

package
v0.0.0-...-c491d80 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Boldtext

func Boldtext(colorable string) string

func GetCommandArguments

func GetCommandArguments(msg string, prefix string) ([]string, error)

GetCommandArguments extracts the command arguments from the command string.

Example
args, err := GetCommandArguments(".interesting_command arg1 arg2", ".")
if err != nil {
	log.Fatal(err)
}
fmt.Println(args)
Output:

[arg1 arg2]

func GetCommandName

func GetCommandName(msg string, prefix string) (string, error)

GetCommandName extracts the command name from the command string.

Example
name, err := GetCommandName(".interesting_command arg1 arg2", ".")
if err != nil {
	log.Fatal(err)
}
fmt.Println(name)
Output:

interesting_command

func GetRandomArrayElement

func GetRandomArrayElement(array []string) (string, error)

GetRandomArrayElement selects a random element from the array. If the array is empty an error is returned.

func Greentext

func Greentext(colorable string) string

func IsChannelName

func IsChannelName(s string) bool

IsChannelName returns true if s is a channel name.

func IsCommand

func IsCommand(msg string, prefix string) bool

func Normaltext

func Normaltext(colorable string) string

func Returntonormal

func Returntonormal(colorable string) string

func SelectReplyTarget

func SelectReplyTarget(e *irc.Event) string

SelectReplyTarget returns the channel name if the message which triggered this event was sent in a channel or the sender's nickname if the message was sent directly to the bot.

Types

This section is empty.

Jump to

Keyboard shortcuts

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