templates

package
Version: v0.0.0-...-765903b Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package templates contains embedded resources

Index

Constants

This section is empty.

Variables

View Source
var (
	ImageFormats = []string{"jpg", "jpeg", "png", "webm", "gif"}
	VideoFormats = []string{"mkv", "webm", "mp4", "ogv"}
	AudioFormats = []string{"mp3", "flac", "ogg", "opus", "aac"}
)
View Source
var Frontpage = template.New("").Funcs(htmlFns)

Functions

func Initialize

func Initialize()

func QuickRender

func QuickRender(content Renderer) errchi.HandlerFunc

func Render

func Render(w io.Writer, content Renderer, tz *time.Location) (int, error)

Types

type Message

type Message struct {
	ID        discord.MessageID
	Author    template.HTML
	Timestamp template.HTML
	Content   template.HTML
	AvatarURL string

	// If the last author is the same
	Small bool

	Message discord.Message
	// contains filtered or unexported fields
}

func RenderMessage

func RenderMessage(state *state.State, dm discord.Message) Message

func (Message) Render

func (m Message) Render(w io.Writer) error

func (Message) RenderWithTimezone

func (m Message) RenderWithTimezone(w io.Writer, location *time.Location) error

type MessageDelete

type MessageDelete struct {
	ID discord.MessageID
}

func (MessageDelete) Render

func (d MessageDelete) Render(w io.Writer) error

type Messages

type Messages []Message

func RenderMessages

func RenderMessages(state *state.State, dmsgs []discord.Message) Messages

func (Messages) Render

func (ms Messages) Render(w io.Writer) error

func (Messages) RenderWithTimezone

func (ms Messages) RenderWithTimezone(w io.Writer, location *time.Location) error

type Renderer

type Renderer interface {
	Render(w io.Writer) error
}

type RendererWithTimezone

type RendererWithTimezone interface {
	RenderWithTimezone(w io.Writer, tz *time.Location) error
}

type Typer

type Typer struct {
	UserID discord.UserID
	Name   string
	When   time.Time
}

type Typing

type Typing struct {
	Typers []Typer
	// contains filtered or unexported fields
}

func (*Typing) AddTyper

func (ts *Typing) AddTyper(t Typer)

func (*Typing) Filter

func (ts *Typing) Filter(fn func(Typer) bool) bool

Filter filters out typers. A true returned keeps the struct. The returned bool is true when the slice is changed.

func (*Typing) Render

func (ts *Typing) Render(w io.Writer) error

func (*Typing) String

func (ts *Typing) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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