handler

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package handler contains the main Discord-related logic for handling messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// ChannelID is the channel where the bot should listen to messages
	// from.
	ChannelID string
}

TODO: move somewhere else

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func New

func New(conf *Config, logger *log.Logger) *Handler

New creates a new handler with the default set of providers enabled.

func NewWithProviders added in v1.1.0

func NewWithProviders(conf *Config, logger *log.Logger, sps []streamingproviders.Provider) *Handler

NewWithProviders creates a new handler with the provided providers.

func (*Handler) EventHandler added in v1.1.0

func (h *Handler) EventHandler(s *discordgo.Session, m *discordgo.MessageCreate)

Handler implements a discordgo.EventHandler for handling new messages being sent.

func (*Handler) NewURL added in v1.1.0

NewURL takes a URL and searches all enabled providers for it. It then searches all provides (minus the one the song was found on) and returns alternative streamingproviders where that song was found (the alternatives).

Jump to

Keyboard shortcuts

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