models

package
v0.0.0-...-89459e6 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CommandsValidator is the validation schema for bot commands collection.
	CommandsValidator = bson.D{
		{Key: "$jsonSchema", Value: bson.D{
			{Key: "bsonType", Value: bson.A{"object", "array"}},
			{Key: "required", Value: bson.A{"guildId", "kind", "name"}},
			{Key: "properties", Value: bson.D{
				{Key: "guildId", Value: bson.D{
					{Key: "bsonType", Value: "long"},
					{Key: "description", Value: "must be a positive non-zero number"},
					{Key: "minimum", Value: 1},
				}},
				{Key: "kind", Value: bson.D{
					{Key: "bsonType", Value: "int"},
					{Key: "description", Value: "must be a valid command kind identifier"},
					{Key: "minimum", Value: 1},
					{Key: "maximum", Value: 1},
				}},
				{Key: "name", Value: bson.D{
					{Key: "bsonType", Value: "string"},
					{Key: "description", Value: "must be a string and is required"},
				}},
			}},
		}},
	}
)

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code        int    `json:"code"`
	Description string `json:"description"`
	Message     string `json:"message,omitempty"`
}

APIError is a struct that contains information about a failed API call.

func (APIError) Error

func (ae APIError) Error() string

type Command

type Command struct {
	ID      primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	GuildID uint64             `bson:"guildId,omitempty" json:"guild_id,omitempty"`
	Kind    CommandKind        `bson:"kind,omitempty" json:"kind,omitempty"`
	Name    string             `bson:"name,omitempty" json:"name,omitempty"`
}

Command is the model for customizable bot commands.

type CommandKind

type CommandKind int

Custom type for command kinds.

const (
	TextCommand CommandKind = 1 << iota
)

Command kinds.

Jump to

Keyboard shortcuts

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