verification

package
v2.48.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MIT Imports: 37 Imported by: 0

README

verification

This plugin provides a simple verification system.

The initial implementation forces you to pass a captcha to get access to the server.

Documentation

Index

Constants

View Source
const DefaultDMMessage = `` /* 191-byte string literal not displayed */
View Source
const (
	DefaultPageContent = `## Verification

Please solve the following reCAPTCHA to make sure you're not a robot`
)

Variables

View Source
var DBSchemas = []string{`
CREATE TABLE IF NOT EXISTS verification_configs  (
	guild_id BIGINT PRIMARY KEY,

	enabled BOOLEAN NOT NULL,

	verified_role BIGINT NOT NULL,

	page_content TEXT NOT NULL,

	kick_unverified_after INT NOT NULL,
	warn_unverified_after INT NOT NULL,
	warn_message TEXT NOT NULL,

	log_channel BIGINT NOT NULL
);
`, `
ALTER TABLE verification_configs ADD COLUMN IF NOT EXISTS dm_message TEXT NOT NULL DEFAULT '';
`, `
CREATE TABLE IF NOT EXISTS verification_sessions  (
	token TEXT PRIMARY KEY,
	user_id BIGINT NOT NULL,
	guild_id BIGINT NOT NULL,
	created_at TIMESTAMP WITH TIME ZONE NOT NULL,

	solved_at TIMESTAMP WITH TIME ZONE,
	expired_at TIMESTAMP WITH TIME ZONE
);
`, `
CREATE TABLE IF NOT EXISTS verified_users (
	guild_id BIGINT NOT NULL,
	user_id BIGINT NOT NULL,

	verified_at TIMESTAMP WITH TIME ZONE NOT NULL,
	ip TEXT NOT NULL,

	PRIMARY KEY(guild_id, user_id)
);
`}
View Source
var PageHTMLControlPanel string
View Source
var PageHTMLVerifyPage string

Functions

func RandStringRunes

func RandStringRunes(n int) string

func RegisterPlugin

func RegisterPlugin()

func ScheduledEventMW

func ScheduledEventMW(innerHandler func(ms *dstate.MemberState, guildID int64, conf *models.VerificationConfig, rawData interface{}) (bool, error)) func(evt *seventsmodels.ScheduledEvent, data interface{}) (retry bool, err error)

func VerificationPendingMembersKey added in v2.1.0

func VerificationPendingMembersKey(gID int64) string

Types

type CheckCAPTCHARequest

type CheckCAPTCHARequest struct {
	Secret   string `json:"secret"`
	Response string `json:"response"`
}

type CheckCAPTCHAResponse

type CheckCAPTCHAResponse struct {
	Success     bool     `json:"success"`
	ChallengeTS string   `json:"challenge_ts"`
	Hostname    string   `json:"hostname"`
	ErrorCodes  []string `json:"error-codes"`
}

type FormData

type FormData struct {
	Enabled             bool
	VerifiedRole        int64  `valid:"role,true"`
	PageContent         string `valid:",10000"`
	KickUnverifiedAfter int    `valid:"0,"`
	WarnUnverifiedAfter int    `valid:"0,"`
	WarnMessage         string `valid:"template,10000"`
	DMMessage           string `valid:"template,10000"`
	LogChannel          int64  `valid:"channel,true"`
}

type Plugin

type Plugin struct{}

func (*Plugin) BotInit

func (p *Plugin) BotInit()

func (*Plugin) CheckBanned

func (p *Plugin) CheckBanned(guildID int64, users []*discordgo.User) (*discordgo.GuildBan, error)

func (*Plugin) InitWeb

func (p *Plugin) InitWeb()

func (*Plugin) LoadServerHomeWidget

func (p *Plugin) LoadServerHomeWidget(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)

func (*Plugin) PluginInfo

func (p *Plugin) PluginInfo() *common.PluginInfo

type RecentGuildBan

type RecentGuildBan struct {
	GuildID int64
	UserID  int64
	T       time.Time
}

type VerificationEventData

type VerificationEventData struct {
	UserID int64  `json:"user_id"`
	Token  string `json:"token"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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