controller

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2022 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	*eventbus.EventBus[ControllerEvent]
	// contains filtered or unexported fields
}

func New

func New(
	db database.IDatabase,
	st storage.IStorage,
	pl *player.Player,
	dg *discord.Discord,
	tw *twitch.Twitch,
	ownerID string,
) (*Controller, error)

func (*Controller) AddFavorite

func (t *Controller) AddFavorite(userID, ident string) error

func (*Controller) CheckAdmin

func (t *Controller) CheckAdmin(userID string) error

func (*Controller) Close

func (t *Controller) Close() error

func (*Controller) CreateSound

func (t *Controller) CreateSound(req CreateSoundRequest) (Sound, error)

func (*Controller) DownloadAllSounds added in v1.4.0

func (t *Controller) DownloadAllSounds() (rc io.ReadCloser, err error)

func (*Controller) GenerateApiKey

func (t *Controller) GenerateApiKey(userID string) (string, error)

func (*Controller) GetAdmins

func (t *Controller) GetAdmins(executorID string) ([]User, error)

func (*Controller) GetApiKey

func (t *Controller) GetApiKey(userID string) (string, error)

func (*Controller) GetCurrentState

func (t *Controller) GetCurrentState(userID string) (EventStatePayload, error)

func (*Controller) GetFastTrigger

func (t *Controller) GetFastTrigger(userID string) (string, error)

func (*Controller) GetFavorites

func (t *Controller) GetFavorites(userID string) ([]string, error)

func (*Controller) GetGuildFilter

func (t *Controller) GetGuildFilter(userID string) (GuildFilters, error)

func (*Controller) GetPlaybackLog

func (t *Controller) GetPlaybackLog(
	guildID, ident, userID string,
	limit, offset int,
) ([]PlaybackLogEntry, error)

func (*Controller) GetPlaybackStats

func (t *Controller) GetPlaybackStats(
	guildID, userID string,
) ([]PlaybackStats, error)

func (*Controller) GetSelfUser

func (t *Controller) GetSelfUser() discordgo.User

func (*Controller) GetSound

func (t *Controller) GetSound(uid string) (Sound, error)

func (*Controller) GetSoundFromYoutube added in v1.3.0

func (t *Controller) GetSoundFromYoutube(req CreateSoundRequest) (Sound, error)

func (*Controller) GetSoundReader added in v1.2.0

func (t *Controller) GetSoundReader(uid string) (io.ReadCloser, int64, error)

func (*Controller) GetState

func (t *Controller) GetState() (StateStats, error)

func (*Controller) GetTwitchState added in v1.5.0

func (t *Controller) GetTwitchState(userid string) (TwitchState, error)

func (*Controller) GetUserByApiKey

func (t *Controller) GetUserByApiKey(token string) (string, error)

func (*Controller) GetVolume

func (t *Controller) GetVolume(userID string) (int, error)

func (*Controller) HasSharedGuild added in v1.5.0

func (t *Controller) HasSharedGuild(userID string) (bool, error)

func (*Controller) ImportSounds added in v1.4.0

func (t *Controller) ImportSounds(userID string, f io.ReadCloser, mimeType string) (ImportResult, error)

func (*Controller) JoinChannel

func (t *Controller) JoinChannel(userID string) error

func (*Controller) LeaveChannel

func (t *Controller) LeaveChannel(guildID, userID string) error

func (*Controller) LeaveTwitch added in v1.5.0

func (t *Controller) LeaveTwitch(userid string) error

func (*Controller) ListSounds

func (t *Controller) ListSounds(
	order string,
	tagsMust []string,
	tagsNot []string,
) ([]Sound, error)

func (*Controller) Play

func (t *Controller) Play(userID, ident string) error

func (*Controller) PlayRandom

func (t *Controller) PlayRandom(userID string, tagsMust []string, tagsNot []string) error

func (*Controller) RemoveAdmin

func (t *Controller) RemoveAdmin(executorID, userID string) error

func (*Controller) RemoveApiKey

func (t *Controller) RemoveApiKey(userID string) error

func (*Controller) RemoveFavorite

func (t *Controller) RemoveFavorite(userID, ident string) error

func (*Controller) RemoveSound

func (t *Controller) RemoveSound(id, userID string) error

func (*Controller) SetAdmin

func (t *Controller) SetAdmin(executorID, userID string) (User, error)

func (*Controller) SetFastTrigger

func (t *Controller) SetFastTrigger(userID, ident string) error

func (*Controller) SetGuildFilter

func (t *Controller) SetGuildFilter(userID string, f GuildFilters) error

func (*Controller) SetVolume

func (t *Controller) SetVolume(userID string, volume int) error

func (*Controller) Stop

func (t *Controller) Stop(userID string) error

func (*Controller) TwitchListSounds added in v1.5.0

func (t *Controller) TwitchListSounds(username string, order string) ([]Sound, error)

func (*Controller) TwitchPlay added in v1.5.0

func (t *Controller) TwitchPlay(username string, ident string) (bool, ratelimit.Reservation, error)

func (*Controller) TwitchState added in v1.5.0

func (t *Controller) TwitchState(username string) (TwitchAPIState, error)

func (*Controller) UpdateSound

func (t *Controller) UpdateSound(newSound UpdateSoundRequest, userID string) (Sound, error)

func (*Controller) UpdateTwitchSettings added in v1.5.0

func (t *Controller) UpdateTwitchSettings(userid string, setting *TwitchSettings, join bool) error

func (*Controller) UploadSound

func (t *Controller) UploadSound(
	r io.Reader,
	size int64,
	mimeType string,
) (string, time.Time, error)

type ControllerEvent

type ControllerEvent struct {
	IsBroadcast bool
	Receivers   []string
	Event       Event[any]
}

Jump to

Keyboard shortcuts

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