music

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Join = &framework.Command{
	Name:               "join",
	PermissionRequired: 0,
	Exec: func(ctx *framework.Context) error {
		channel, err := ctx.GetSenderVoiceChannel()
		optionalVCId := ctx.GetArgIndexDefault(0, "")

		if len(optionalVCId) > 0 {
			err = ctx.Hanamaru.VoiceContext.JoinChannel(ctx.Hanamaru.Session, ctx.GuildID, optionalVCId, ctx.ChannelID)
			if err != nil {
				return err
			}
		}

		if err != nil {
			return err
		}

		err = ctx.Hanamaru.VoiceContext.JoinChannel(ctx.Hanamaru.Session, ctx.GuildID, channel.ID, ctx.ChannelID)
		if err != nil {
			return err
		}

		return nil
	},
}
View Source
var Leave = &framework.Command{
	Name:               "leave",
	PermissionRequired: 0,
	Exec: func(ctx *framework.Context) error {
		channel, err := ctx.GetSenderVoiceChannel()
		if err != nil {
			return err
		}
		err = ctx.Hanamaru.VoiceContext.LeaveChannel(ctx.GuildID, channel.ID)
		if err != nil {
			return err
		}
		return nil
	},
}
View Source
var Play = &framework.Command{
	Name:               "play",
	PermissionRequired: 0,
	Exec: func(ctx *framework.Context) error {
		_, ok := ctx.Hanamaru.VoiceContext.VCs[ctx.GuildID]
		if !ok {
			return fmt.Errorf("cannot play when im not connected")
		}

		queueChan, ok := ctx.Hanamaru.VoiceContext.QueueChannels[ctx.GuildID]
		if !ok {
			return fmt.Errorf("this isnt supposed to happen wot")
		}

		videoUrl, err := ctx.GetArgIndex(0)
		if err != nil {
			return errors.New("please pass in a valid video URL")
		}

		queueChan <- voice.NewYTSrc(videoUrl, ctx.Hanamaru.VoiceContext.Ytdl)

		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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