models

package
v0.0.0-...-d3d8adc Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreateChannelQuery = `` /* 139-byte string literal not displayed */

	UpdateChannelQuery = `` /* 132-byte string literal not displayed */

)
View Source
const (
	CreateGuildQuery = `` /* 476-byte string literal not displayed */

	UpdateGuildQuery = `` /* 456-byte string literal not displayed */

	ResetGuildQuery = `` /* 295-byte string literal not displayed */

)
View Source
const (
	SelectGuildMembersQuery = `
			SELECT * FROM member
			WHERE guild_id=? AND member_id > ?
			ORDER BY member_id ASC
			LIMIT ?
		`
	CreateMemberQuery = `
		INSERT INTO member 
			(member_id, guild_id, joined_at, ` + "`left`" + `, xp, level)
		VALUES
			(:member_id, :guild_id, :joined_at, :left, :xp, :level)
		`
	ResetMemberQuery = `
		UPDATE member SET
			` + "`left`" + `=DEFAULT, xp=DEFAULT, level=DEFAULT
		WHERE
			guild_id=? AND member_id=?
		`
	ResetGuildMembersQuery = `
		UPDATE member SET
			` + "`left`" + `=DEFAULT, xp=DEFAULT, level=DEFAULT
		WHERE
			guild_id=?
		`
	UpdateMemberQuery = `
		UPDATE member SET 
			` + "`left`" + `=:left, xp=:xp, level=:level
		WHERE 
			guild_id=:guild_id AND member_id=:member_id
		`
)
View Source
const (
	CreateRoleQuery = `` /* 172-byte string literal not displayed */

	UpdateRoleQuery = `` /* 163-byte string literal not displayed */

)
View Source
const (
	InsertUserQuery = `` /* 195-byte string literal not displayed */

	UpdateUserQuery = `
		UPDATE user SET
			email=:email, discord_id=:discord_id, pwd_hash=:pwd_hash, salt=:salt
		WHERE 
			username=:username
			`
)
View Source
const (
	CreateBanQuery = `` /* 174-byte string literal not displayed */

)
View Source
const (
	CreateWarnQuery = `` /* 156-byte string literal not displayed */

)

Variables

This section is empty.

Functions

This section is empty.

Types

type Ban

type Ban struct {
	BanID     int                 `json:"banID" db:"ban_id"`         // ID of the ban
	MemberID  string              `json:"memberID" db:"member_id"`   // ID of the member
	GuildID   string              `json:"guildID" db:"guild_id"`     // ID of the guild
	BannerID  nulltype.NullString `json:"bannerID" db:"banner_id"`   // ID of the user who banned the member
	BannedAt  time.Time           `json:"bannedAt" db:"banned_at"`   // Date the member was banned
	BanReason nulltype.NullString `json:"banReason" db:"ban_reason"` // Reason for the ban
	AutoBan   bool                `json:"autoBan" db:"auto_ban"`     // Whether the ban was automatic or not
}

type Channel

type Channel struct {
	ChannelID     string `json:"channelID" db:"channel_id"`         // ID of the channel
	GuildID       string `json:"guildID" db:"guild_id"`             // ID of the guild
	Ignored       bool   `json:"ignored" db:"ignored"`              // Wether the channel is ignored by the bot or not
	XpBlacklisted bool   `json:"xpBlacklisted" db:"xp_blacklisted"` // Wether the channel is blacklisted from xp or not
}

type Guild

type Guild struct {
	GuildID           string              `json:"guildID" db:"guild_id"`                      // Guild ID
	GuildName         string              `json:"guildName" db:"guild_name"`                  // Name of the guild
	Prefix            string              `json:"prefix" db:"prefix"`                         // Prefix used for calling the bot
	ReportChannel     nulltype.NullString `json:"reportChannel" db:"report_channel"`          // Channel ID for reporting
	WelcomeChannel    nulltype.NullString `json:"welcomeChannel" db:"welcome_channel"`        // Channel ID to send welcome messages
	WelcomeMsg        nulltype.NullString `json:"welcomeMsg" db:"welcome_message"`            // Message to send when a user joins
	PrivateWelcomeMsg nulltype.NullString `json:"privateWelcomeMsg" db:"private_welcome_msg"` // Message to send when a user joins in DM
	LvlChannel        nulltype.NullString `json:"lvlChannel" db:"level_channel"`              // Channel ID to send level up messages
	LvlReplace        bool                `json:"lvlReplace" db:"level_replace"`              // Weather or not to replace previous rewards
	LvlResponse       int                 `json:"lvlResponse" db:"level_response"`            // If the level is a multiple of this number, send a level up message
	DisabledCommands  nulltype.NullString `json:"disabledCommands" db:"disabled_commands"`    // List of disabled commands separated by slashes
	AllowModeration   bool                `json:"allowModeration" db:"allow_moderation"`      // Whether or not to allow moderation commands
	MaxWarns          int                 `json:"maxWarns" db:"max_warns"`                    // Max number of warnings before a user is banned
	BanTime           int                 `json:"banTime" db:"ban_time"`                      // Time in days to ban a user for

}

type GuildPres

type GuildPres struct {
	GuildID   string `json:"guildID" db:"guildID"`     // Guild ID
	GuildName string `json:"guildName" db:"guildname"` // Name of the guild
	Prefix    string `json:"prefix" db:"prefix"`       // Prefix used for calling the bot
}

type Member

type Member struct {
	MemberID string            `json:"memberID" db:"member_id"`                    // Member ID
	GuildID  string            `json:"guildID" db:"guild_id"`                      // Guild ID
	JoinedAt nulltype.NullTime `json:"joinedAt" db:"joined_at" format:"date-time"` // Date for when the member joined the guild
	Left     int               `json:"left" db:"left"`                             // Number of times the member left the guild
	Xp       int               `json:"xp" db:"xp"`                                 // Amount of xp the member has
	Level    int               `json:"level" db:"level"`                           // Level of the member
}

type Role

type Role struct {
	RoleID        string `json:"roleID" db:"role_id"`               // ID of the role
	GuildID       string `json:"guildID" db:"guild_id"`             // ID of the guild
	IsDefault     bool   `json:"isDefault" db:"is_default"`         // Wether to give the role to new members
	Reward        int    `json:"reward" db:"reward"`                // The level corresponding to the reward
	Ignored       bool   `json:"ignored" db:"ignored"`              // Wether the role is ignored by the bot or not
	XpBlacklisted bool   `json:"xpBlacklisted" db:"xp_blacklisted"` // Wether the role is blacklisted from xp or not
}

type User

type User struct {
	Username     string              `json:"username" db:"username"`    // Username of the user
	Email        string              `json:"email" db:"email"`          // Email of the user
	DiscordID    nulltype.NullString `json:"discordID" db:"discord_id"` // Discord ID of the user
	PasswordHash string              `json:"-" db:"pwd_hash"`           // Password hash of the user
	Salt         string              `json:"-" db:"salt"`               // Salt used on the password
	AccessLvl    int                 `json:"accessLvl" db:"access_lvl"` // Access level to the api of the user
	CreatedAt    time.Time           `json:"createdAt" db:"created_at"` // Date the user was created
	Banned       bool                `json:"banned" db:"banned"`        // Whether the user is banned or not
}

type UserCreation

type UserCreation struct {
	Username  string              `json:"username" db:"username" form:"username"`     // Username of the user
	Email     string              `json:"email" db:"email" form:"email"`              // Email of the user
	DiscordID nulltype.NullString `json:"discordID" db:"discord_id" form:"discordID"` // Discord ID of the user
	Password  string              `json:"password" db:"-" form:"password"`            // Password of the user
}

func (*UserCreation) Validate

func (u *UserCreation) Validate() error

Validate UserCreation fields

type UserModification

type UserModification struct {
	Email       string              `json:"email" db:"email"`          // Email of the user
	DiscordID   nulltype.NullString `json:"discordID" db:"discord_id"` // Discord ID of the user
	OldPassword string              `json:"oldPassword" db:"-"`        // Old password of the user
	Password    string              `json:"password" db:"-"`           // New password of the user
}

type Warn

type Warn struct {
	WarnID     int                 `json:"warnID" db:"warn_id"`         // ID of the warn
	MemberID   string              `json:"memberID" db:"member_id"`     // ID of the member
	GuildID    string              `json:"guildID" db:"guild_id"`       // ID of the guild
	WarnerID   nulltype.NullString `json:"warnerID" db:"warner_id"`     // ID of the user who warned the member
	WarnedAt   time.Time           `json:"warnedAt" db:"warned_at"`     // Date the member was warned
	WarnReason nulltype.NullString `json:"warnReason" db:"warn_reason"` // Reason for the warn
}

Jump to

Keyboard shortcuts

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