streaming

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2018 License: MIT Imports: 18 Imported by: 0

README

Streaming

Extends the built-in streaming status in discord with some extra utility features.

Redis layout:

Key Type Value
streaming_config:{{guildID}} Json encoded string The config for this server
currenly_streaming:{{guildID}} Set of user ID's Holds all the people yagpdb has currenly found streaming in this guild

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = &Config{
	Enabled:         false,
	AnnounceMessage: "OH WOWIE! **{{.User.Username}}** is currently streaming! Check it out: {{.URL}}",
}

Functions

func CheckPresence

func CheckPresence(client *redis.Client, config *Config, p *discordgo.Presence, member *discordgo.Member, gs *dstate.GuildState) error

func GiveStreamingRole

func GiveStreamingRole(member *discordgo.Member, role int64, guild *discordgo.Guild) error

func HandleGuildCreate

func HandleGuildCreate(evt *eventsystem.EventData)

func HandleGuildMemberUpdate

func HandleGuildMemberUpdate(evt *eventsystem.EventData)

func HandlePostStreaming

func HandlePostStreaming(w http.ResponseWriter, r *http.Request) interface{}

func HandlePresenceUpdate

func HandlePresenceUpdate(evt *eventsystem.EventData)

func HandleUpdateStreaming

func HandleUpdateStreaming(event *pubsub.Event)

YAGPDB event

func KeyCurrentlyStreaming

func KeyCurrentlyStreaming(gID int64) string

func RegisterPlugin

func RegisterPlugin()

func RemoveStreaming

func RemoveStreaming(client *redis.Client, config *Config, guildID int64, userID int64, member *discordgo.Member)

func RemoveStreamingRole

func RemoveStreamingRole(member *discordgo.Member, role int64, guildID int64)

func SendStreamingAnnouncement

func SendStreamingAnnouncement(client *redis.Client, config *Config, guild *dstate.GuildState, member *discordgo.Member, p *discordgo.Presence)

Types

type ConextKey

type ConextKey int
const (
	ConextKeyConfig ConextKey = iota
)

type Config

type Config struct {
	Enabled bool `json:"enabled" schema:"enabled"` // Wether streaming notifications is enabled or not

	// Give a role to people streaming
	GiveRole int64 `json:"give_role,string" schema:"give_role" valid:"role,true"`
	// Ignores people with this role, requirerole is ignored if this is set
	IgnoreRole int64 `json:"ban_role,string" schema:"ignore_role" valid:"role,true"`
	// Requires people to have this role
	RequireRole int64 `json:"require_role,string" schema:"require_role" valid:"role,true"`

	// Channel to send streaming announcements in
	AnnounceChannel int64 `json:"announce_channel,string" schema:"announce_channel" valid:"channel,true"`
	// The message
	AnnounceMessage string `json:"announce_message" schema:"announce_message" valid:"template,2000"`
}

func GetConfig

func GetConfig(client *redis.Client, guildID int64) (*Config, error)

Returns he guild's conifg, or the defaul one if not set

func (*Config) Save

func (c *Config) Save(client *redis.Client, guildID int64) error

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(b []byte) error

type LegacyConfig

type LegacyConfig struct {
	Enabled bool `json:"enabled" schema:"enabled"` // Wether streaming notifications is enabled or not

	// Give a role to people streaming
	GiveRole string `json:"give_role" schema:"give_role" valid:"role,true"`
	// Ignores people with this role, requirerole is ignored if this is set
	IgnoreRole string `json:"ban_role" schema:"ignore_role" valid:"role,true"`
	// Requires people to have this role
	RequireRole string `json:"require_role" schema:"require_role" valid:"role,true"`

	// Channel to send streaming announcements in
	AnnounceChannel string `json:"announce_channel" schema:"announce_channel" valid:"channel,true"`
	// The message
	AnnounceMessage string `json:"announce_message" schema:"announce_message" valid:"template,2000"`
}

type Plugin

type Plugin struct{}

func (*Plugin) InitBot

func (p *Plugin) InitBot()

func (*Plugin) InitWeb

func (p *Plugin) InitWeb()

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) StartBot

func (p *Plugin) StartBot()

Jump to

Keyboard shortcuts

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