utils

package
v0.0.0-...-886a64d Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StrongGreen = 0x09D67C
	Green       = 0x10E6AD
	LightGreen  = 0x9DDDCD
	DarkRed     = 0x831010
	Red         = 0xF74D53
	LightBlue   = 0x34A6F4
	Blue        = 0x10889E
	Rose        = 0xF8C7DA
	Camel       = 0xF4D694
	Violet      = 0xC5A2FF

	Error        = DarkRed
	Alert        = Red
	Success      = Green
	GreatSuccess = StrongGreen
	Neutral      = Camel
	Nice         = Rose
)
View Source
const (
	AnsiReset       = "\033[0m"
	AnsiRed         = "\033[31m"
	AnsiGreen       = "\033[32m"
	AnsiYellow      = "\033[33m"
	AnsiBlue        = "\033[34m"
	AnsiMagenta     = "\033[35m"
	AnsiCyan        = "\033[36m"
	AnsiWhite       = "\033[37m"
	AnsiBlueBold    = "\033[34;1m"
	AnsiMagentaBold = "\033[35;1m"
	AnsiRedBold     = "\033[31;1m"
	AnsiYellowBold  = "\033[33;1m"
)

Variables

View Source
var DebugEnabled bool

Functions

func AStringContains

func AStringContains(a []string, b string) bool

AStringContains checks if a slice "a" contains a "b" string

func ComesFromDM

func ComesFromDM(s *discordgo.Session, id string) (bool, error)

ComesFromDM returns true if a message comes from a DM channel

func FetchGuildUser

func FetchGuildUser(s *discordgo.Session, guildID string) []*discordgo.Member

FetchGuildUser returns the list of member in a guild

func GetTimestampFromId

func GetTimestampFromId(id string) (time.Time, error)

func HoursOfUnix

func HoursOfUnix(unix int64) uint

HoursOfUnix returns the hours of a unix timestamp

func NewTimers

func NewTimers(d time.Duration, fn func(chan struct{}))

NewTimers produce a new async ticker.

d is for the duration between two ticks and fn is the functions called at each tick: it takes a chan in parameter, and you can put anything here to disable the ticker

func SendAlert

func SendAlert(pos string, message string)

SendAlert sends an alert

func SendDebug

func SendDebug(message ...any)

SendDebug sends a debug message

func SendError

func SendError(err error)

SendError sends an error (like a panic(any...))

func SendSuccess

func SendSuccess(message string)

SendSuccess sends a success message

func SendWarn

func SendWarn(message string)

SendWarn sends a warning message

func TrimMessage

func TrimMessage(s string) string

TrimMessage trims a "s" string and remove bad chars, links and pings

Types

This section is empty.

Jump to

Keyboard shortcuts

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