Documentation ¶
Index ¶
- Constants
- Variables
- func CanUseAdmin(useAdmin bool, adminRoomID, actualRoomID id.RoomID) bool
- func Command(evt *event.Event) ([]string, bool)
- func File(name, content string) *mautrix.ReqUploadMedia
- func HomeserverCommand(evt *event.Event) (string, string)
- func MapKeys[T string, V any](data map[string]V) []string
- func MessageCommand(message string) (string, string)
- func MessageToSchedule(message string) (string, string, string)
- func Output(out []byte, max int) string
- func OutputToMessage(prefix, command string, out []byte, err error, logOnError bool, logsize int, ...) (string, string)
- func ParseCommandTemplate(command string, vars any) (*exec.Cmd, string, error)
- func ParseDomains(text string) []string
- func RelativeDate(in string) (time.Time, error)
- func SortRelativeDate(slice []string)
- func Uniq(slice []string) []string
Constants ¶
const ( // MinCommandLen minimal length of standard command MinCommandLen = 2 // MinAdminCommandLen minimal length of admin command MinAdminCommandLen = 3 )
Variables ¶
var ( // AdminRoomID of the scheduler AdminRoomID id.RoomID // ErrWrongDate is returned when date is in wrong format ErrWrongDate = errors.New("wrong date format") )
Functions ¶
func CanUseAdmin ¶
CanUseAdmin checks if recurring/schedule/run can UseAdmin = useAdmin
func File ¶
func File(name, content string) *mautrix.ReqUploadMedia
File parses name and content to matrix upload media request
func HomeserverCommand ¶
Homeserver parse homeserver AND command from matrix event
func MessageCommand ¶
MessageCommand parses a message (eg 'run restart irc') to command name and args (eg: "restart", "irc")
func MessageToSchedule ¶
MessageToScheduler parses a schedule message (eg 'schedule resart 2006-01-02 15:04 irc') to command message, datetime and args (eg: "run restart", "2006-01-02 15:04", "irc")
func OutputToMessage ¶
func OutputToMessage(prefix, command string, out []byte, err error, logOnError bool, logsize int, useAdmin bool, homeserver string) (string, string)
OutputToMessage parses run output to human-friendly message and full log output
func ParseCommandTemplate ¶
ParseCommandTemplate parses a command template and returns a executable command
func ParseDomains ¶
ParseDomains parses the output of the list command (comma-separated list of domains) and returns a list of domains
func RelativeDate ¶
RelativeDate converts "Tuesday 20:00" to time.Time
func SortRelativeDate ¶
func SortRelativeDate(slice []string)
SortRelativeDate sorts slice by relative date
Types ¶
This section is empty.