play

package
v0.0.0-...-91b6c6a Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: GPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionCancel    = "cancel"
	ActionPlayNow   = "play_now"
	ActionPlayOther = "play_other"
	ActionSelect    = "select"
)

Variables

View Source
var PlayCommand = command.Command{
	Name: "play", Aliases: []string{"p"},
	Deferred:    true,
	Validations: []*command.Validation{validations.MustBeOnAValidVoiceChannel},
	Parameters: []*command.Parameter{
		{Name: "song", Required: true, Type: parameters.ParameterText},
	},
	Handler: func(ctx *command.Context) command.Result {
		t := ctx.T.(*i18n.CommandPlay)

		input := ctx.Args[0].(string)

		if res := handleSpotifyLink(ctx, input, t); res != nil {
			return *res
		}

		return searchYoutube(ctx, input, t)
	},
}
View Source
var (
	SpotifyTrackRe = regexp.MustCompile(`^https?:\/\/open.spotify.com\/track\/([^/]+)$`)
)

Functions

func BuildPlayableInfoEmbed

func BuildPlayableInfoEmbed(info PlayableInfo) *model.Embed

func CalcETA

func CalcETA(playable playable.Playable, vc *voicer.Voicer) time.Duration

Types

type PlayableInfo

type PlayableInfo struct {
	Playable    playable.Playable
	Voicer      *voicer.Voicer
	RequesterID string
	T           *i18n.PlayingInfo
	Common      *i18n.Common
}

type SearchContext

type SearchContext struct {
	*command.Context

	SearchQuery string
	Results     []*youtube.SearchResult
	Voicer      *voicer.Voicer

	SelectionCh chan Selection
}

type Selection

type Selection struct {
	Type  SelectionType
	Index int
}

type SelectionType

type SelectionType string
const (
	SelectionTypeCancel SelectionType = "cancel"
	SelectionTypeSelect SelectionType = "select"
)

Jump to

Keyboard shortcuts

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