play

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockedPlayer

type MockedPlayer struct {
	mock.Mock
}

MockedPlayer is the mocking implementation of Player.

func NewMockedPlayer

func NewMockedPlayer() *MockedPlayer

NewMockedPlayer returns a new MockedPlayer.

func (*MockedPlayer) Play

func (p *MockedPlayer) Play(guildID string, trackID string, opts ...*Options) error

Play plays the track with the given id on the guild's audio player. More options can be configured via Options.

type Options

type Options struct {
	// StartTime defines the time from which the
	// track is to be played.
	StartTime uint `json:"startTime,omitempty"`

	// EndTime defines the time until the track is
	// to be played.
	EndTime uint `json:"endTime,omitempty"`

	// Volume defines the volume at which the track
	// is played.
	Volume uint `json:"volume,omitempty"`

	// NoReplace defines whether this action should be
	// ignored if another track is currently playing.
	NoReplace bool `json:"noReplace,omitempty"`

	// Paused defines whether the playback should be paused.
	Paused bool `json:"paused,omitempty"`
}

Options is used to configure further specifications of the Player.Play method.

func MinimizeOptions

func MinimizeOptions(opts ...*Options) *Options

MinimizeOptions minimizes the passed options to a single one.

func NewOptions

func NewOptions() *Options

NewOptions returns a new Options.

func (*Options) WithEndTime

func (opts *Options) WithEndTime(endTime uint) *Options

WithEndTime sets the end time to the parameter value.

func (*Options) WithNoReplace

func (opts *Options) WithNoReplace(noReplace bool) *Options

WithNoReplace sets no replace to the parameter value.

func (*Options) WithPaused

func (opts *Options) WithPaused(paused bool) *Options

WithPaused sets paused to the parameter value.

func (*Options) WithStartTime

func (opts *Options) WithStartTime(startTime uint) *Options

WithStartTime sets the start time to the parameter value.

func (*Options) WithVolume

func (opts *Options) WithVolume(volume uint) *Options

WithVolume sets the volume to the parameter value.

type Player

type Player interface {
	// Play plays the track with the given id on the
	// guild's audio player.
	// More options can be configured via Options.
	Play(guildID string, trackID string, opts ...*Options) error
}

Player wraps the Play method.

Jump to

Keyboard shortcuts

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