guild

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

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"
	ErrUnableToSetParentAsSelf          = "unable to set parent as self"
	ErrUnableToSetParentForCategory     = "unable to set parent for category"
	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"

	// 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"
)

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, attachTTLSeconds int64, authSecret string, defaultVoiceRegion string, disco discovery.Manager, allowedRegions []string, 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.
	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.
	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 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 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