logs

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2018 License: MIT Imports: 24 Imported by: 0

README

Logs

The logs plugin logs certain information from servers.

  • Can store a subset of the message history with deleted messages
  • Username changes

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AuthorColors = []string{
	"7c7cff",
	"529fb7",
	"4aa085",
	"7ea04a",
	"a0824a",
	"a04a4a",
	"a04a89",
}
View Source
var (
	ErrChannelBlacklisted = errors.New("Channel blacklisted from creating message logs")
)

Functions

func CheckNickname

func CheckNickname(gDB *gorm.DB, nicknameStmt *sql.Stmt, userID, guildID int64, nickname string)

func CheckNicknameBulk added in v1.4.1

func CheckNicknameBulk(gDB *gorm.DB, guildID int64, members []*discordgo.Member)

func CheckUsername

func CheckUsername(gDB *gorm.DB, usernameStmt *sql.Stmt, user *discordgo.User)

func CheckUsernameBulk added in v1.4.1

func CheckUsernameBulk(gDB *gorm.DB, users []*discordgo.User)

func EvtProcesser

func EvtProcesser()

Queue up all the events and process them one by one, because of limited connections

func EvtProcesserGCs

func EvtProcesserGCs()

func HandleDeleteMessageJson

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

func HandleGC

func HandleGC(evt *eventsystem.EventData)

func HandleLogsCP

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

func HandleLogsCPDelete

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

func HandleLogsCPSaveGeneral

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

func HandleLogsHTML

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

func HandleMsgDelete

func HandleMsgDelete(evt *eventsystem.EventData)

Mark all log messages with this id as deleted

func HandlePresenceUpdate

func HandlePresenceUpdate(evt *eventsystem.EventData)

func HandleQueueEvt

func HandleQueueEvt(evt *eventsystem.EventData)

While presence update is sent when user changes username.... MAKES NO SENSE IMO BUT WHATEVER Also check nickname incase the user came online

func RegisterPlugin added in v1.4.1

func RegisterPlugin()

Types

type DeleteData

type DeleteData struct {
	ID string
}

type GeneralFormData

type GeneralFormData struct {
	UsernameLoggingEnabled       bool
	NicknameLoggingEnabled       bool
	ManageMessagesCanViewDeleted bool
	EveryoneCanViewDeleted       bool
	BlacklistedChannels          []string
}

type GuildLoggingConfig

type GuildLoggingConfig struct {
	configstore.GuildConfigModel
	UsernameLoggingEnabled bool
	NicknameLoggingEnabled bool
	BlacklistedChannels    string

	ManageMessagesCanViewDeleted bool
	EveryoneCanViewDeleted       bool

	ParsedBlacklistedchannels []int64 `gorm:"-"`
}

func GetConfig

func GetConfig(guildID int64) (*GuildLoggingConfig, error)

Returns either stored config, err or a default config

func (*GuildLoggingConfig) GetName

func (g *GuildLoggingConfig) GetName() string

func (*GuildLoggingConfig) PostFetch

func (g *GuildLoggingConfig) PostFetch()

type LightGC added in v1.4.1

type LightGC struct {
	GuildID int64
	Members []*discordgo.Member
}

type Message

type Message struct {
	common.SmallModel
	MessageLogID uint `gorm:"index"` // Foreign key, belongs to MessageLog

	MessageID string `gorm:"index"`
	Content   string `gorm:"size:2000"`
	Timestamp string

	AuthorUsername string
	AuthorDiscrim  string
	AuthorID       string
	Deleted        bool

	Color string `gorm:"-"`
}

type MessageLog

type MessageLog struct {
	gorm.Model
	Messages []Message

	ChannelName string
	ChannelID   string
	GuildID     string

	Author   string
	AuthorID string
}

func CreateChannelLog

func CreateChannelLog(config *GuildLoggingConfig, guildID, channelID int64, author string, authorID int64, count int) (*MessageLog, error)

func GetChannelLogs

func GetChannelLogs(id int64) (*MessageLog, error)

func GetGuilLogs

func GetGuilLogs(guildID int64, before, after, limit int) ([]*MessageLog, error)
func (m *MessageLog) Link() string

type NicknameListing

type NicknameListing struct {
	gorm.Model
	UserID   int64 `gorm:"index"`
	GuildID  string
	Nickname string
}

func GetNicknames

func GetNicknames(userID, guildID int64, limit int) ([]NicknameListing, error)

type Plugin

type Plugin struct{}

func (*Plugin) AddCommands added in v1.4.1

func (p *Plugin) AddCommands()

func (*Plugin) BotInit added in v1.4.1

func (p *Plugin) BotInit()

func (*Plugin) InitWeb

func (lp *Plugin) InitWeb()

func (*Plugin) Name

func (p *Plugin) Name() string

type UsernameListing

type UsernameListing struct {
	gorm.Model
	UserID   int64 `gorm:"index"`
	Username string
}

func GetUsernames

func GetUsernames(userID int64, limit int) ([]UsernameListing, error)

Jump to

Keyboard shortcuts

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