guild

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrIncorrectEmojiID         = "incorrect emoji ID"
	ErrUnableToCreateEmoji      = "unable to create emoji"
	ErrUnableToGetEmojis        = "unable to get emojis"
	ErrUnableToUpdateEmoji      = "unable to update emoji"
	ErrUnableToDeleteEmoji      = "unable to delete emoji"
	ErrEmojiNameRequired        = "emoji name is required"
	ErrEmojiNameInvalid         = "emoji name can only contain latin letters, numbers, and hyphens"
	ErrEmojiNameTaken           = "emoji name already exists"
	ErrEmojiQuotaExceeded       = "emoji limit reached"
	ErrEmojiActiveLimitExceeded = "too many pending emoji uploads"
	ErrEmojiStorageUnavailable  = "emoji storage is not configured"
)
View Source
const (
	ErrUnableToGetUserToken              = "unable to get user token"
	ErrUnableToGetGuildMemberToken       = "unable to get guild member token"
	ErrUnableToGetGuildMembers           = "unable to get guild members"
	ErrUnableToGetUsersRoles             = "unable to get users roles"
	ErrUnableToGetGuildMembersProfiles   = "unable to get guild members profiles"
	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"
	ErrIncorrectIconID                   = "incorrect icon ID"
	ErrFileIsTooBig                      = "file is too big"
	ErrUnableToSendMessage               = "unable to send message"
	ErrUnableToGetUser                   = "unable to get user"
	ErrUnableToGetUsers                  = "unable to get users"
	ErrUnableToGetUserDiscriminator      = "unable to get discriminator"
	ErrUnableToGetDiscriminators         = "unable to get discriminators"
	ErrUnableToGetAttachements           = "unable to get attachments"
	ErrUnableToCreateGuild               = "unable to create guild"
	ErrUnableToGetGuildMember            = "unable to get member"
	ErrUnableToGetDiscriminator          = "unable to get discriminator"
	ErrUnableToGetGuildByID              = "unable to get guild by id"
	ErrUnableToUpdateGuild               = "unable to update guild"
	ErrUnableToDeleteGuild               = "unable to delete 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"
	ErrNotAMember                        = "not a member"
	ErrUnableToGetReadState              = "unable to get read state"
	ErrUnableToSetReadState              = "unable to set read state"
	ErrUnableToIssueVoiceToken           = "unable to issue voice token"
	ErrNoSFUAvailableInRegion            = "no sfu available in region"
	ErrNotAVoiceChannel                  = "not a voice channel"
	ErrUnableToGetPermission             = "unable to get permissions"
	ErrUnableToSetSystemMessagesChannel  = "unable to set system messages channel"
	ErrUnableToCheckGuildBan             = "unable to check guild ban"
	ErrUnableToRemoveMember              = "unable to remove member"
	ErrUnableToBanMember                 = "unable to ban member"
	ErrUnableToUnbanMember               = "unable to unban member"
	ErrUnableToGetGuildBans              = "unable to get guild bans"
	ErrCannotModerateGuildOwner          = "cannot moderate guild owner"
	ErrOnlyOwnerCanModerateAdministrator = "only guild owner can moderate administrators"
	ErrUserIsBanned                      = "user is banned"

	// 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"
	ErrUnableToDeleteActiveIcon = "unable to delete active icon"
	ErrBanReasonTooLong         = "ban reason must be 256 characters or fewer"
)

Variables

This section is empty.

Functions

func New

func New(dbcon *db.CQLCon, pg *pgdb.DB, mqt mq.SendTransporter, imq *indexmq.IndexMQ, cache cache.Cache, storage *s3.Client, attachTTLSeconds int64, authSecret string, defaultVoiceRegion string, disco discovery.Manager, allowedRegions []string, log *slog.Logger) server.Entity

Types

type BanMemberRequest added in v1.7.0

type BanMemberRequest struct {
	Reason *string `json:"reason,omitempty"`
}

func (BanMemberRequest) Validate added in v1.7.0

func (r BanMemberRequest) Validate() error

type ChannelOrder

type ChannelOrder struct {
	Id       int64 `json:"id,string" 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 CreateEmojiRequest added in v1.7.0

type CreateEmojiRequest struct {
	Name        string `json:"name"`
	FileSize    int64  `json:"file_size"`
	ContentType string `json:"content_type"`
}

func (CreateEmojiRequest) Validate added in v1.7.0

func (r CreateEmojiRequest) 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.
	Position int    `json:"position" default:"0"`         // Channel position in the list. Should be set as the last position in the channel list, or it will be one of the first in the list.
}

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.
	Position int               `json:"position" default:"0"`                    // Channel position in the list. Should be set as the last position in the channel list, or it will be one of the first in the list.
}

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 CreateIconRequest added in v1.5.0

type CreateIconRequest struct {
	FileSize    int64  `json:"file_size" example:"120000"`
	ContentType string `json:"content_type" example:"image/png"`
}

CreateIconRequest is a request to create guild icon metadata

func (CreateIconRequest) Validate added in v1.5.0

func (r CreateIconRequest) 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 JoinVoiceResponse added in v1.5.0

type JoinVoiceResponse struct {
	SFUURL   string `json:"sfu_url"`
	SFUToken string `json:"sfu_token"`
}

JoinVoiceResponse is the response for successful voice join initiation.

type MoveMemberRequest added in v1.5.0

type MoveMemberRequest struct {
	UserID    int64 `json:"user_id"`
	ChannelID int64 `json:"channel_id"`
	From      int64 `json:"from"`
}

MoveMemberRequest is used to move a user to another voice channel.

type MoveMemberResponse added in v1.5.0

type MoveMemberResponse struct {
	Ok           bool   `json:"ok"`
	FromSFUURL   string `json:"from_sfu_url,omitempty"`
	FromSFUToken string `json:"from_sfu_token,omitempty"`
}

MoveMemberResponse acknowledges the move request dispatch.

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.
	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 PatchGuildRoleOrderRequest added in v1.7.0

type PatchGuildRoleOrderRequest struct {
	Roles []RoleOrder `json:"roles"` // List of roles to change order.
}

func (PatchGuildRoleOrderRequest) Validate added in v1.7.0

func (r PatchGuildRoleOrderRequest) 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 RoleOrder added in v1.7.0

type RoleOrder struct {
	Id       int64 `json:"id,string" example:"2230469276416868352"` // Role ID.
	Position int   `json:"position" example:"4"`                    // New role position.
}

func (RoleOrder) Validate added in v1.7.0

func (r RoleOrder) Validate() error

type SetGuildSystemMessagesChannelRequest added in v1.5.0

type SetGuildSystemMessagesChannelRequest struct {
	ChannelId *int64 `json:"channel_id" example:"2230469276416868352"` // Channel ID
}

type SetVoiceRegionRequest added in v1.5.0

type SetVoiceRegionRequest struct {
	Region string `json:"region"`
}

SetVoiceRegionRequest is the body for setting a channel's preferred voice region.

type SetVoiceRegionResponse added in v1.5.0

type SetVoiceRegionResponse struct {
	GuildID   int64  `json:"guild_id"`
	ChannelID int64  `json:"channel_id"`
	Region    string `json:"region,omitempty"`
}

SetVoiceRegionResponse is the response for successful region update.

type UpdateEmojiRequest added in v1.7.0

type UpdateEmojiRequest struct {
	Name string `json:"name"`
}

func (UpdateEmojiRequest) Validate added in v1.7.0

func (r UpdateEmojiRequest) 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