guild

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrUnableToGetUserToken         = "unable to get user token"
	ErrUnableToGetGuildMemberToken  = "unable to get guild member token"
	ErrUnableToParseBody            = "unable to parse body"
	ErrPermissionsRequired          = "permissions required"
	ErrUnableToCreateAttachment     = "unable to create attachment"
	ErrUnableToCreateUploadURL      = "unable to create upload url"
	ErrIncorrectChannelID           = "incorrect channel ID"
	ErrIncorrectGuildID             = "incorrect guild ID"
	ErrIncorrectMemberID            = "incorrect member ID"
	ErrIncorrectInviteID            = "incorrect invite ID"
	ErrIncorrectRoleID              = "incorrect role ID"
	ErrFileIsTooBig                 = "file is too big"
	ErrUnableToSendMessage          = "unable to send message"
	ErrUnableToGetUser              = "unable to get user"
	ErrUnableToGetUserDiscriminator = "unable to get discriminator"
	ErrUnableToGetAttachements      = "unable to get attachments"
	ErrUnableToCreateGuild          = "unable to create guild"
	ErrUnableToGetGuildMember       = "unable to get member"
	ErrUnableToGetGuildByID         = "unable to get guild by id"
	ErrUnableToUpdateGuild          = "unable to update guild"
	ErrUnableToGetRoles             = "unable to get roles"
	ErrUnableToSetUserRole          = "unable to set user role"
	ErrUnableToRemoveUserRole       = "unable to remove user role"
	ErrUnableToCreateChannelGroup   = "unable to create channel group"
	ErrUnableToGetChannel           = "unable to get channel"
	ErrUnableToUpdateChannel        = "unable to update channel"
	ErrUnableToSetParentAsSelf      = "unable to set parent as self"
	ErrUnableToSetParentForCategory = "unable to set parent for category"
	ErrNotAMember                   = "not a member"
	// Channel role permissions
	ErrUnableToGetChannelRolePerms = "unable to get channel role permissions"
	ErrUnableToSetChannelRolePerm  = "unable to set channel role permission"
	ErrUnableToUpdateChannelRole   = "unable to update channel role permission"
	ErrUnableToRemoveChannelRole   = "unable to remove channel role permission"
	// Invites
	ErrUnableToCreateInvite = "unable to create invite"
	ErrUnableToGetInvites   = "unable to get invites"
	ErrUnableToDeleteInvite = "unable to delete invite"
	ErrInviteNotFound       = "invite not found"
	ErrInviteCodeInvalid    = "invalid invite code"
	ErrRoleNotInGuild       = "role does not belong to this guild"

	// Validation error messages
	ErrGuildNameRequired   = "guild name is required"
	ErrGuildNameTooShort   = "guild name must be at least 2 characters"
	ErrGuildNameTooLong    = "guild name must be less than 100 characters"
	ErrChannelNameRequired = "channel name is required"
	ErrChannelNameTooShort = "channel name must be at least 2 characters"
	ErrChannelNameTooLong  = "channel name must be less than 100 characters"
	ErrChannelNameInvalid  = "channel name can only contain letters, numbers, hyphens, and underscores"
	ErrChannelTypeInvalid  = "invalid channel type"
	ErrIconIdInvalid       = "icon ID must be positive"
	ErrParentIdInvalid     = "parent ID must be positive"
	ErrPermissionsInvalid  = "permissions must be non-negative"
	// Roles
	ErrRoleNameRequired = "role name is required"
	ErrRoleNameTooShort = "role name must be at least 2 characters"
	ErrRoleNameTooLong  = "role name must be less than 100 characters"
	ErrRoleColorInvalid = "role color must be between 0 and 16777215"
)

Variables

This section is empty.

Functions

func New

func New(dbcon *db.CQLCon, pg *pgdb.DB, mqt mq.SendTransporter, log *slog.Logger) server.Entity

Types

type ChannelOrder

type ChannelOrder struct {
	Id       int64 `json:"id" example:"2230469276416868352"` // Channel ID.
	Position int   `json:"position" example:"4"`             // New channel position.
}

func (ChannelOrder) Validate

func (c ChannelOrder) Validate() error

type ChannelRolePermission

type ChannelRolePermission struct {
	RoleId int64 `json:"role_id" example:"2230469276416868352"` // Role ID
	Accept int64 `json:"accept" example:"0"`                    // Allowed permission bits mask
	Deny   int64 `json:"deny" example:"0"`                      // Denied permission bits mask
}

Channel role permissions

type ChannelRolePermissionRequest

type ChannelRolePermissionRequest struct {
	Accept int64 `json:"accept" example:"0"` // Allowed permission bits mask
	Deny   int64 `json:"deny" example:"0"`   // Denied permission bits mask
}

func (ChannelRolePermissionRequest) Validate

func (r ChannelRolePermissionRequest) Validate() error

type CreateGuildChannelCategoryRequest

type CreateGuildChannelCategoryRequest struct {
	Name    string `json:"name" example:"category-name"` // Category channel name
	Private bool   `json:"private" default:"false"`      // Whether the category channel is private. Private channels can only be seen by users with roles assigned to this channel.
}

func (CreateGuildChannelCategoryRequest) Validate

type CreateGuildChannelRequest

type CreateGuildChannelRequest struct {
	Name     string            `json:"name" example:"channel-name"`             // Channel name
	Type     model.ChannelType `json:"type" example:"0"`                        // Channel type
	ParentId *int64            `json:"parent_id" example:"2230469276416868352"` // Parent channel ID. A Parent channel can only be a category channel.
	Private  bool              `json:"private" default:"false"`                 // Whether the channel is private. Private channels can only be seen by users with roles assigned to this channel.
}

func (CreateGuildChannelRequest) Validate

func (r CreateGuildChannelRequest) Validate() error

type CreateGuildRequest

type CreateGuildRequest struct {
	Name   string `json:"name" example:"My unique guild"`        // Guild name
	IconId *int64 `json:"icon_id" example:"2230469276416868352"` // Icon ID
	Public bool   `json:"public" default:"false"`                // Whether the guild is public
}

func (CreateGuildRequest) Validate

func (r CreateGuildRequest) Validate() error

type CreateGuildRoleRequest

type CreateGuildRoleRequest struct {
	Name        string `json:"name" example:"New Role"`  // Role name
	Color       int    `json:"color" example:"16777215"` // RGB int value
	Permissions int64  `json:"permissions" default:"0"`  // Permissions bitset
}

func (CreateGuildRoleRequest) Validate

func (r CreateGuildRoleRequest) Validate() error

type CreateInviteRequest

type CreateInviteRequest struct {
	ExpiresInSec *int `json:"expires_in_sec" example:"86400"` // Expiration time in seconds. 0 means unlimited.
}

Invites

func (CreateInviteRequest) Validate

func (r CreateInviteRequest) Validate() error

type PatchGuildChannelOrderRequest

type PatchGuildChannelOrderRequest struct {
	Channels []ChannelOrder `json:"channels"` // List of channels to change order.
}

func (PatchGuildChannelOrderRequest) Validate

func (r PatchGuildChannelOrderRequest) Validate() error

type PatchGuildChannelRequest

type PatchGuildChannelRequest struct {
	Name     *string `json:"name,omitempty" example:"new-channel-name"`         // Channel name.
	ParentId *int64  `json:"parent_id,omitempty" example:"2230469276416868352"` // Parent channel ID. A Parent channel can only be a category channel.
	Private  *bool   `json:"private,omitempty" default:"false"`                 // Whether the channel is private. Private channels can only be seen by users with roles assigned to this channel.
	Topic    *string `json:"topic,omitempty" example:"Just a channel topic"`    // Channel topic.
}

func (PatchGuildChannelRequest) Validate

func (r PatchGuildChannelRequest) Validate() error

type PatchGuildRoleRequest

type PatchGuildRoleRequest struct {
	Name        *string `json:"name,omitempty" example:"Moderators"` // Role name
	Color       *int    `json:"color,omitempty" example:"16711680"`  // RGB int value
	Permissions *int64  `json:"permissions,omitempty"`               // Permissions bitset
}

func (PatchGuildRoleRequest) Validate

func (r PatchGuildRoleRequest) Validate() error

type UpdateGuildRequest

type UpdateGuildRequest struct {
	Name        *string `json:"name" example:"New guild name"`         // Guild name
	IconId      *int64  `json:"icon_id" example:"2230469276416868352"` // Icon ID
	Public      *bool   `json:"public" default:"false"`                // Whether the guild is public
	Permissions *int64  `json:"permissions" default:"7927905"`         // Permissions. Check the permissions documentation for more info.
}

func (UpdateGuildRequest) Validate

func (r UpdateGuildRequest) Validate() error

Jump to

Keyboard shortcuts

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