notifications

package
v1.13.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2019 License: MIT Imports: 17 Imported by: 0

README

Notifications

Simple notifications plugin for YAGPDB.

Will provide general notifications in a server for the following events:

  • User join
  • User leave
  • Topic changed
  • Message pinned

Documentation

Index

Constants

View Source
const (
	RecordSeparator = "\x1e"
	MaxUserMessages = 10
)

Variables

View Source
var DefaultConfig = &Config{}

Functions

func HandleChannelUpdate

func HandleChannelUpdate(evt *eventsystem.EventData)

func HandleGuildMemberAdd

func HandleGuildMemberAdd(evtData *eventsystem.EventData)

func HandleGuildMemberRemove

func HandleGuildMemberRemove(evt *eventsystem.EventData)

func HandleNotificationsGet

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

func HandleNotificationsPost

func HandleNotificationsPost(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)

func RegisterPlugin

func RegisterPlugin()

Types

type Config

type Config struct {
	configstore.GuildConfigModel
	JoinServerEnabled bool   `json:"join_server_enabled" schema:"join_server_enabled"`
	JoinServerChannel string `json:"join_server_channel" schema:"join_server_channel" valid:"channel,true"`

	// TODO: Remove the legacy single-message variant when ready to migrate the
	// database.
	JoinServerMsg  string   `json:"join_server_msg" valid:"template,2000"`
	JoinServerMsgs []string `json:"join_server_msgs" schema:"join_server_msgs" gorm:"-" valid:"template,2000"`
	// Do Not Use! For persistence only.
	JoinServerMsgs_ string `json:"-"`

	JoinDMEnabled bool   `json:"join_dm_enabled" schema:"join_dm_enabled"`
	JoinDMMsg     string `json:"join_dm_msg" schema:"join_dm_msg" valid:"template,2000"`

	LeaveEnabled bool     `json:"leave_enabled" schema:"leave_enabled"`
	LeaveChannel string   `json:"leave_channel" schema:"leave_channel" valid:"channel,true"`
	LeaveMsg     string   `json:"leave_msg" schema:"leave_msg" valid:"template,500"`
	LeaveMsgs    []string `json:"leave_msgs" schema:"leave_msgs" gorm:"-" valid:"template,500"`
	// Do Not Use! For persistence only.
	LeaveMsgs_ string `json:"-"`

	TopicEnabled bool   `json:"topic_enabled" schema:"topic_enabled"`
	TopicChannel string `json:"topic_channel" schema:"topic_channel" valid:"channel,true"`

	CensorInvites bool `schema:"censor_invites"`
}

func GetConfig

func GetConfig(guildID int64) *Config

func (*Config) AfterFind added in v0.29.1

func (c *Config) AfterFind() (err error)

GORM AfterFind hook

func (*Config) BeforeSave added in v0.29.1

func (c *Config) BeforeSave() (err error)

GORM BeforeSave hook

func (*Config) GetName

func (c *Config) GetName() string

func (*Config) JoinServerChannelInt

func (c *Config) JoinServerChannelInt() (i int64)

func (*Config) LeaveChannelInt

func (c *Config) LeaveChannelInt() (i int64)

func (*Config) TableName

func (c *Config) TableName() string

func (*Config) TopicChannelInt

func (c *Config) TopicChannelInt() (i int64)

type Plugin

type Plugin struct{}

func (*Plugin) BotInit added in v1.4.1

func (p *Plugin) BotInit()

func (*Plugin) InitWeb

func (p *Plugin) InitWeb()

func (*Plugin) Name

func (p *Plugin) Name() string

Jump to

Keyboard shortcuts

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