Documentation ¶
Index ¶
- Constants
- Variables
- func BaseEditHandler(inner web.ControllerHandlerFunc) web.ControllerHandlerFunc
- func KeyLastVidID(channel string) string
- func KeyLastVidTime(channel string) string
- func MaxFeedsForContext(ctx context.Context) int
- func RegisterPlugin()
- type ChannelSubscription
- type ContextKey
- type CtxKey
- type Form
- type Link
- type LinkEntry
- type Plugin
- func (p *Plugin) AddFeed(guildID, discordChannelID int64, youtubeChannelID, youtubeUsername string, ...) (*ChannelSubscription, error)
- func (p *Plugin) HandleEdit(w http.ResponseWriter, r *http.Request) (templateData web.TemplateData, err error)
- func (p *Plugin) HandleFeedUpdate(w http.ResponseWriter, r *http.Request)
- func (p *Plugin) HandleMQueueError(elem *mqueue.QueuedElement, err error)
- func (p *Plugin) HandleNew(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
- func (p *Plugin) HandleRemove(w http.ResponseWriter, r *http.Request) (templateData web.TemplateData, err error)
- func (p *Plugin) HandleYoutube(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
- func (p *Plugin) InitWeb()
- func (p *Plugin) MaybeAddChannelWatch(lock bool, channel string) error
- func (p *Plugin) MaybeRemoveChannelWatch(channel string)
- func (p *Plugin) Name() string
- func (p *Plugin) PlaylistID(channelID string) (string, error)
- func (p *Plugin) SetupClient() error
- func (p *Plugin) StartFeed()
- func (p *Plugin) Status() (string, string)
- func (p *Plugin) StopFeed(wg *sync.WaitGroup)
- func (p *Plugin) ValidateSubscription(w http.ResponseWriter, r *http.Request, query url.Values)
- func (p *Plugin) WebSubSubscribe(ytChannelID string) error
- func (p *Plugin) WebSubUnsubscribe(ytChannelID string) error
- type XMLFeed
- type YoutubePlaylistID
Constants ¶
View Source
const ( MaxChannelsPerPoll = 30 PollInterval = time.Second * 10 WebSubCheckInterval = time.Second * 10 )
View Source
const ( RedisChannelsLockKey = "youtube_subbed_channel_lock" RedisKeyWebSubChannels = "youtube_registered_websub_channels" GoogleWebsubHub = "https://pubsubhubbub.appspot.com/subscribe" )
View Source
const ( GuildMaxFeeds = 50 GuildMaxFeedsPremium = 250 )
Variables ¶
View Source
var (
ErrIDNotFound = errors.New("ID not found")
)
View Source
var (
ErrNoChannel = errors.New("No channel with that id found")
)
View Source
var (
WebSubVerifyToken = os.Getenv("YAGPDB_YOUTUBE_VERIFY_TOKEN")
)
Functions ¶
func BaseEditHandler ¶
func BaseEditHandler(inner web.ControllerHandlerFunc) web.ControllerHandlerFunc
func KeyLastVidID ¶
func KeyLastVidTime ¶
func MaxFeedsForContext ¶ added in v1.6.0
func RegisterPlugin ¶
func RegisterPlugin()
Types ¶
type ChannelSubscription ¶
type ChannelSubscription struct { common.SmallModel GuildID string ChannelID string YoutubeChannelID string YoutubeChannelName string MentionEveryone bool }
func SubsForChannel ¶
func SubsForChannel(channel string) (result []*ChannelSubscription, err error)
func (*ChannelSubscription) TableName ¶
func (c *ChannelSubscription) TableName() string
type Plugin ¶
type Plugin struct { common.BasePlugin YTService *youtube.Service Stop chan *sync.WaitGroup }
func (*Plugin) HandleEdit ¶
func (p *Plugin) HandleEdit(w http.ResponseWriter, r *http.Request) (templateData web.TemplateData, err error)
func (*Plugin) HandleFeedUpdate ¶
func (p *Plugin) HandleFeedUpdate(w http.ResponseWriter, r *http.Request)
func (*Plugin) HandleMQueueError ¶
func (p *Plugin) HandleMQueueError(elem *mqueue.QueuedElement, err error)
Remove feeds if they don't point to a proper channel
func (*Plugin) HandleNew ¶
func (p *Plugin) HandleNew(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
func (*Plugin) HandleRemove ¶
func (p *Plugin) HandleRemove(w http.ResponseWriter, r *http.Request) (templateData web.TemplateData, err error)
func (*Plugin) HandleYoutube ¶
func (p *Plugin) HandleYoutube(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
func (*Plugin) MaybeAddChannelWatch ¶
maybeAddChannelWatch adds a channel watch to redis, if there wasn't one before
func (*Plugin) MaybeRemoveChannelWatch ¶
maybeRemoveChannelWatch checks the channel for subs, if it has none then it removes it from the watchlist in redis.
func (*Plugin) SetupClient ¶
func (*Plugin) ValidateSubscription ¶
func (*Plugin) WebSubSubscribe ¶
func (*Plugin) WebSubUnsubscribe ¶
type XMLFeed ¶
type XMLFeed struct { Xmlns string `xml:"xmlns,attr"` Link []Link `xml:"link"` ChannelID string `xml:"entry>channelId"` Published string `xml:"entry>published"` VideoId string `xml:"entry>videoId"` Yt string `xml:"yt,attr"` LinkEntry Link `xml:"entry>link"` AuthorUri string `xml:"entry>author>uri"` AuthorName string `xml:"entry>author>name"` UpdatedEntry string `xml:"entry>updated"` Title string `xml:"title"` TitleEntry string `xml:"entry>title"` Id string `xml:"entry>id"` Updated string `xml:"updated"` }
Click to show internal directories.
Click to hide internal directories.