guild

package
v0.0.0-...-7245f98 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveThreadsResponse

type ActiveThreadsResponse struct {
	Threads []*sigil.Channel      `json:"threads"`
	Members []*sigil.ThreadMember `json:"members"`
}

ActiveThreadsResponse contains data regarding the active threads within the Guild.

type AddMemberOptions

type AddMemberOptions struct {
	AccessToken string `json:"access_token"`
	// Requires `MANAGE_NICKNAMES`
	Nick string `json:"nick,omitempty"`
	// Requires `MANAGE_ROLES`
	Roles []string `json:"roles,omitempty"`
	// Requires `MUTE_MEMBERS`
	Mute bool `json:"mute,omitempty"`
	// Requires `DEAFEN_MEMBERS`
	Deaf bool `json:"deaf,omitempty"`
}

AddMemberOptions contains parameters used when adding a User to a Guild. The `AccessToken` field expects a valid OAuth2 access token for the user with the `guilds.join` scope.

type BeginPruneOptions

type BeginPruneOptions struct {
	Days              int      `json:"days"`
	ComputePruneCount bool     `json:"compute_prune_count"`
	IncludeRoles      []string `json:"include_roles"`
}

BeginPruneOptions configures a Guild prune. Per Discord, it's recommended to set `ComputePruneCount` to false for large Guilds.

type CreateBanOptions

type CreateBanOptions struct {
	DeleteMessageDays int `json:"delete_message_days,omitempty"`
}

CreateBanOptions contains parameters used when banning a Member.

type CreateChannelOptions

type CreateChannelOptions struct {
	Name                 string            `json:"name"`
	Type                 sigil.ChannelType `json:"type,omitempty"`
	Topic                string            `json:"topic,omitempty"`
	Bitrate              int               `json:"bitrate,omitempty"`
	UserLimit            int               `json:"user_limit,omitempty"`
	RateLimitPerUser     int               `json:"rate_limit_per_user,omitempty"`
	Position             int               `json:"position,omitempty"`
	PermissionOverwrites []sigil.Overwrite `json:"permissions_overwrites,omitempty"`
	ParentID             string            `json:"parent_id,omitempty"`
	NSFW                 bool              `json:"nsfw,omitempty"`
}

CreateChannelOptions contains parameters used to create a new Guild Channel.

type CreateEmojiOptions

type CreateEmojiOptions struct {
	Name  string   `json:"name"`
	Image string   `json:"image"`
	Roles []string `json:"roles"`
}

CreateEmojiOptions are used to create a new Emoji on the Guild.

type CreateRoleOptions

type CreateRoleOptions struct {
	Name         string `json:"name,omitempty"`
	Permissions  string `json:"permissions,omitempty"`
	Color        int    `json:"color,omitempty"`
	Hoist        bool   `json:"hoist,omitempty"`
	Icon         string `json:"icon,omitempty"`
	UnicodeEmoji string `json:"unicode_emoji,omitempty"`
	Mentionable  bool   `json:"mentionable,omitempty"`
}

CreateRoleOptions contains parameters used to create a new Role.

type CreateStickerOptions

type CreateStickerOptions struct {
	Name        string
	Description string
	Tags        string
	File        *sigil.File
}

CreateStickerOptions are used to create a new Sticker on the Guild.

type Fly

type Fly struct {
	// contains filtered or unexported fields
}

Fly is a resource for interacting with a Discord Guild.

func New

func New(cli flies.RestClient, token string, guildID string) *Fly

New creates a new Fly.

func (*Fly) AddMember

func (f *Fly) AddMember(ctx context.Context, id string, opts *AddMemberOptions) (*sigil.GuildMember, error)

AddGuildMember adds a User to the Guild by the given ID. Your bot must have the `CREATE_INSTANT_INVITE` permission. The returned *GuildMember may be nil if the user is already part of the Guild.

See AddMemberOptions for additional information.

func (*Fly) AddMemberRole

func (f *Fly) AddMemberRole(ctx context.Context, userID, roleID, reason string) error

AddMemberRole adds a role to the given Member by their ID.

Requires `MANAGE_ROLES`.

func (*Fly) BeginPrune

func (f *Fly) BeginPrune(ctx context.Context, reason string, opts *BeginPruneOptions) (*GetPruneCountResponse, error)

BeginPrune begins a prune operation.

Requires `KICK_MEMBERS`.

func (*Fly) CreateBan

func (f *Fly) CreateBan(ctx context.Context, id, reason string, opts *CreateBanOptions) error

CreateBan bans a Member from the Guild by their ID.

Requires `BAN_MEMBERS`.

func (*Fly) CreateChannel

func (f *Fly) CreateChannel(ctx context.Context, reason string, opts CreateChannelOptions) (*sigil.Channel, error)

CreateChannel creates a new Guild Channel from the given options.

Requires `MANAGE_CHANNELS`; if setting permissions, you may only use permissions your bot has. Setting `MANAGE_ROLES` is only possible for those with `ADMINISTRATOR`.

func (*Fly) CreateEmoji

func (f *Fly) CreateEmoji(ctx context.Context, reason string, opts *CreateEmojiOptions) (*sigil.Emoji, error)

CreateEmoji creates a new Emoji on the Guild.

Requires `MANAGE_EMOJI_AND_STICKERS`.

func (*Fly) CreateRole

func (f *Fly) CreateRole(ctx context.Context, reason string, opts *CreateRoleOptions) (*sigil.Role, error)

CreateRole creates a new Role in the Guild.

func (*Fly) CreateSticker

func (f *Fly) CreateSticker(ctx context.Context, reason string, opts *CreateStickerOptions) (*sigil.Sticker, error)

CreateSticker creates a new Sticker on the Guild.

Require `MANAGE_EMOJIS_AND_STICKERS`.

func (*Fly) Delete

func (f *Fly) Delete(ctx context.Context) error

Delete deletes the Guild; the associated User must be owner to do so.

func (*Fly) DeleteEmoji

func (f *Fly) DeleteEmoji(ctx context.Context, id, reason string) error

DeleteEmoji deletes an Emoji from the Guild.

func (*Fly) DeleteIntegration

func (f *Fly) DeleteIntegration(ctx context.Context, id, reason string) (*sigil.Integration, error)

DeleteIntegration deletes an Integration.

Requires `MANAGE_GUILD`.

func (*Fly) DeleteRole

func (f *Fly) DeleteRole(ctx context.Context, id, reason string) error

DeleteRole deletes a Role from the Guild. Requires `MANAGE_ROLES`.

func (*Fly) DeleteSticker

func (f *Fly) DeleteSticker(ctx context.Context, id, reason string) error

DeleteSticker deletes a Sticker from the Guild.

func (*Fly) Get

func (f *Fly) Get(ctx context.Context, withCounts bool) (*sigil.Guild, error)

Get fetches the associated Guild from Discord.

func (*Fly) GetBan

func (f *Fly) GetBan(ctx context.Context, id string) (*sigil.Ban, error)

GetBan retrieves Guild ban for the given id.

Requires `BAN_MEMBERS`.

func (*Fly) GetBans

func (f *Fly) GetBans(ctx context.Context) ([]*sigil.Ban, error)

GetBans fetches the list of bans for the Guild.

Requires `BAN_MEMBERS`.

func (*Fly) GetChannels

func (f *Fly) GetChannels(ctx context.Context) ([]*sigil.Channel, error)

GetChannels fetches a Guild's channels, not including Threads.

func (*Fly) GetEmoji

func (f *Fly) GetEmoji(ctx context.Context, id string) (*sigil.Emoji, error)

GetEmoji fetches a single Emoji from the Guild.

func (*Fly) GetIntegrations

func (f *Fly) GetIntegrations(ctx context.Context) ([]*sigil.Integration, error)

GetIntegrations fetches the Guild's Integrations.

Requires `MANAGE_GUILD`.

func (*Fly) GetInvites

func (f *Fly) GetInvites(ctx context.Context) ([]*sigil.Invite, error)

GetInvites fetches the Guild's Invites.

func (*Fly) GetMember

func (f *Fly) GetMember(ctx context.Context, id string) (*sigil.GuildMember, error)

GetMember fetches a Guild Member by their ID.

func (*Fly) GetPreview

func (f *Fly) GetPreview(ctx context.Context) (*sigil.Guild, error)

GetPreview fetches the Preview object for the associated Guild. Since the object definitions are similar, a *Guild is returned, but some fields will be missing.

func (*Fly) GetPruneCount

func (f *Fly) GetPruneCount(ctx context.Context, days int, rolesIncluded ...string) (*GetPruneCountResponse, error)

GetPruneCount returns the number of Members that would be pruned with the given parameters.

Requires `KICK_MEMBERS`.

func (*Fly) GetRoles

func (f *Fly) GetRoles(ctx context.Context) ([]*sigil.Role, error)

GetRoles fetches the Guild's list of Roles.

func (*Fly) GetSticker

func (f *Fly) GetSticker(ctx context.Context, id string) (*sigil.Sticker, error)

GetSticker fetches a Sticker by its ID on a Guild.

func (*Fly) GetVanityURL

func (f *Fly) GetVanityURL(ctx context.Context) (*sigil.Invite, error)

GetVanityURL fetches a partial Invite containing the Guild's vanity URL, if set.

Requires `MANAGE_GUILD`.

func (*Fly) GetVoiceRegions

func (f *Fly) GetVoiceRegions(ctx context.Context) ([]*sigil.VoiceRegion, error)

GetVoiceRegions fetches the Guild's voice regions.

func (*Fly) GetWelcomeScreen

func (f *Fly) GetWelcomeScreen(ctx context.Context) (*sigil.WelcomeScreen, error)

GetWelcomeScreen fetches the Guild's Welcome Screen object.

func (*Fly) GetWidget

func (f *Fly) GetWidget(ctx context.Context) (*sigil.GuildWidget, error)

GetWidget fetches the Guild's Widget.

func (*Fly) GetWidgetImage

func (f *Fly) GetWidgetImage(ctx context.Context, style string) (string, error)

GetWidgetImage returns a URL to a PNG image for the Guild's widget.

See Discord's Documentation for valid styles. https://discord.com/developers/docs/resources/guild#get-guild-widget-image

func (*Fly) GetWidgetSettings

func (f *Fly) GetWidgetSettings(ctx context.Context) (*sigil.GuildWidgetSettings, error)

GetWidgetSettings returns the Widget Settings for the Guild.

func (*Fly) ListActiveThreads

func (f *Fly) ListActiveThreads(ctx context.Context) (*ActiveThreadsResponse, error)

ListActiveThreads returns all of the active threads within a Guild, including public and private. Threads are ordered, descending, by `id`.

func (*Fly) ListEmojis

func (f *Fly) ListEmojis(ctx context.Context) ([]*sigil.Emoji, error)

ListEmojis fetches the Guild's list of emojis.

func (*Fly) ListMembers

func (f *Fly) ListMembers(ctx context.Context, limit int, after string) ([]*sigil.GuildMember, error)

ListMembers fetches the list of GuildMembers within the associated Guild. This requires your application has the `GUILD_MEMBERS` privileged intent enabled.

func (*Fly) ListStickers

func (f *Fly) ListStickers(ctx context.Context) ([]*sigil.Sticker, error)

ListStickers fetches the list of Stickers on a Guild.

func (*Fly) ModifyChannelPositions

func (f *Fly) ModifyChannelPositions(ctx context.Context, reason string, opts ...*ModifyChannelPositionsOptions) error

ModifyChannelPositions modifies the position of one or more Guild Channels.

func (*Fly) ModifyCurrentMember

func (f *Fly) ModifyCurrentMember(ctx context.Context, reason string, opts *ModifyCurrentMember) (*sigil.GuildMember, error)

ModifyCurrentMember modifies the Member of the associated token.

func (*Fly) ModifyCurrentUserVoiceState

func (f *Fly) ModifyCurrentUserVoiceState(ctx context.Context, opts *ModifyCurrentUserVoiceStateOptions) error

ModifyCurrentUserVoiceState updates the associated User's voice state on the Guild.

func (*Fly) ModifyEmoji

func (f *Fly) ModifyEmoji(ctx context.Context, id, reason string, opts *ModifyEmojiOptions) (*sigil.Emoji, error)

ModifyEmoji modifies an Emoji on a Guild.

Requires `MANAGE_EMOJIS_AND_STICKERS`.

func (*Fly) ModifyGuild

func (f *Fly) ModifyGuild(ctx context.Context, reason string, opts *ModifyOptions) (*sigil.Guild, error)

ModifyGuild modifies a Guild, requiring the `MANAGE_GUILD` permission.

func (*Fly) ModifyMember

func (f *Fly) ModifyMember(ctx context.Context, id, reason string, opts ModifyMemberOptions) (*sigil.GuildMember, error)

ModifyGuildMember modifies a GuildMember.

See ModifyMemberOptions for additional information.

func (*Fly) ModifyRole

func (f *Fly) ModifyRole(ctx context.Context, id, reason string, opts *ModifyRoleOptions) (*sigil.Role, error)

ModifyRole modifies a Role on the Guild.

Requires `MANAGE_ROLE`.

func (*Fly) ModifyRolePositions

func (f *Fly) ModifyRolePositions(ctx context.Context, reason string, opts []*ModifyRolePositionsOptions) ([]*sigil.Role, error)

ModifyRolePositions modifies the position of the given Guild Roles.

func (*Fly) ModifySticker

func (f *Fly) ModifySticker(ctx context.Context, id, reason string, opts *ModifyStickerOptions) (*sigil.Sticker, error)

ModifySticker modifies a Sticker on a Guild.

Requires `MANAGE_EMOJIS_AND_STICKERS`.

func (*Fly) ModifyUserVoiceState

func (f *Fly) ModifyUserVoiceState(ctx context.Context, id string, opts *ModifyUserVoiceStateOptions) error

ModifyUserVoiceState modifies another User's voice state in the Guild.

func (*Fly) ModifyWelcomeScreen

func (f *Fly) ModifyWelcomeScreen(ctx context.Context, reason string, opts *ModifyWelcomeScreenOptions) (*sigil.WelcomeScreen, error)

ModifyGuildWelcomeScreen modifies the Guild's Welcome Screen.

Requires `MANAGE_GUILD`.

func (*Fly) ModifyWidget

func (f *Fly) ModifyWidget(ctx context.Context, reason string, opts *sigil.GuildWidgetSettings) (*sigil.GuildWidgetSettings, error)

ModifyWidget updates the settings of the Guild's Widget.

func (*Fly) RemoveBan

func (f *Fly) RemoveBan(ctx context.Context, id, reason string) error

RemoveBan removes a ban on the given ID.

Requires `BAN_MEMBERS`.

func (*Fly) RemoveMember

func (f *Fly) RemoveMember(ctx context.Context, id, reason string) error

RemoveMember removes a Member from the Guild by their ID; AKA "kicking".

Requires `KICK_MEMBERS`.

func (*Fly) RemoveMemberRole

func (f *Fly) RemoveMemberRole(ctx context.Context, userID, roleID, reason string) error

RemoveMemberRole removes a Role from the given Member by their ID.

Requires `MANAGE_ROLES`.

func (*Fly) SearchMembers

func (f *Fly) SearchMembers(ctx context.Context, query string, limit int) ([]*sigil.GuildMember, error)

SearchMembers searches a Guild for members meeting the given criteria.

type GetPruneCountResponse

type GetPruneCountResponse struct {
	Pruned null.Int `json:"pruned"`
}

GetPruneCountResponse returns a computed count of the number of Members that would be, or were, pruned.

type ModifyChannelPositionsOptions

type ModifyChannelPositionsOptions struct {
	ID              string      `json:"id"`
	Position        null.Int    `json:"position"`
	LockPermissions null.Bool   `json:"lock_permissions"`
	ParentID        null.String `json:"parent_id"`
}

ModifyChannelPositionsOptions contains parameters used to change a Channel's position in the Guild Channel list.

type ModifyCurrentMember

type ModifyCurrentMember struct {
	// Requires `CHANGE_NICKNAME`
	Nick null.String `json:"nick,omitempty"`
}

ModifyCurrentMember contains parameters used to modify the Member of the associated token.

type ModifyCurrentUserVoiceStateOptions

type ModifyCurrentUserVoiceStateOptions struct {
	ChannelID               string     `json:"channel_id"`
	Suppress                bool       `json:"suppress,omitempty"`
	RequestToSpeakTimestamp sigil.Time `json:"request_to_speak_timestamp,omitempty"`
}

ModifyCurrentUserVoiceStateOptions configure the current User's voice state on the Guild.

type ModifyEmojiOptions

type ModifyEmojiOptions struct {
	Name  string   `json:"name,omitempty"`
	Roles []string `json:"roles,omitempty"`
}

ModifyEmojiOptions are used to modify an Emoji on a Guild.

type ModifyMemberOptions

type ModifyMemberOptions struct {
	Nick      null.String `json:"nick,omitempty"`
	Roles     []string    `json:"roles,omitempty"`
	Mute      null.Bool   `json:"mute,omitempty"`
	Deaf      null.Bool   `json:"deaf,omitempty"`
	ChannelID null.String `json:"channel_id,omitempty"`
}

ModifyMemberOptions contains parameters used to modify a GuildMember.

If ChannelID is specified, the API user must have permission to both connect to the associated channel, and the `MOVE_MEMBERS` permission.

When ChannelID is null, the target user will be disconnected from voice.

type ModifyOptions

type ModifyOptions struct {
	Name                        string                                `json:"name,omitempty"`
	Region                      string                                `json:"region,omitempty"`
	VerificationLevel           sigil.VerificationLevel               `json:"verification_level,omitempty"`
	DefaultMessageNotifications sigil.DefaultMessageNotificationLevel `json:"default_message_notifications,omitempty"`
	ExplicitContentFilter       sigil.ExplicitContentFilterLevel      `json:"explicit_content_filter,omitempty"`
	AFKChannelID                null.String                           `json:"afk_channel_id"`
	AFKTimeout                  int                                   `json:"afk_timeout"`
	Icon                        null.String                           `json:"icon,omitempty"`
	OwnerID                     string                                `json:"owner_id,omitempty"`
	Splash                      null.String                           `json:"splash,omitempty"`
	DiscoverySplash             null.String                           `json:"discovery_splash,omitempty"`
	Banner                      null.String                           `json:"banner,omitempty"`
	SystemChannelID             null.String                           `json:"system_channel_id,omitempty"`

	SystemChannelFlags     sigil.SystemChannelFlag `json:"system_channel_flags,omitempty"`
	RulesChannelID         null.String             `json:"rules_channel_id,omitempty"`
	PublicUpdatesChannelID null.String             `json:"public_updates_channel_id,omitempty"`
	PreferredLocale        null.String             `json:"preferred_locale,omitempty"`
	Features               []string                `json:"features,omitempty"`
	Description            null.String             `json:"description,omitempty"`
}

ModifyOptions contains parameters used to modify a Guild.

type ModifyRoleOptions

type ModifyRoleOptions struct {
	Name         null.String `json:"name,omitempty"`
	Permissions  null.String `json:"permissions,omitempty"`
	Color        null.Int    `json:"color,omitempty"`
	Hoist        null.Bool   `json:"hoist,omitempty"`
	Icon         null.String `json:"icon,omitempty"`
	UnicodeEmoji null.String `json:"unicode_emoji,omitempty"`
	Mentionable  null.Bool   `json:"mentionable,omitempty"`
}

ModifyRoleOptions contains parameters used to modify a Guild Role.

type ModifyRolePositionsOptions

type ModifyRolePositionsOptions struct {
	ID       string   `json:"id"`
	Position null.Int `json:"position,omitempty"`
}

ModifyRolePositionsOptions contains parameters used to modify a Guild Role's position.

type ModifyStickerOptions

type ModifyStickerOptions struct {
	Name        string      `json:"name,omitempty"`
	Description null.String `json:"description,omitempty"`
	Tags        string      `json:"tags,omitempty"`
}

ModifyStickerOptions are used to modify a Sticker on a Guild.

type ModifyUserVoiceStateOptions

type ModifyUserVoiceStateOptions struct {
	ChannelID string `json:"channel_id"`
	Suppress  bool   `json:"suppress,omitempty"`
}

ModifyUserVoiceStateOptions is used to modify another User's voice state in the Guild.

type ModifyWelcomeScreenOptions

type ModifyWelcomeScreenOptions struct {
	Enabled         null.Bool                     `json:"enabled,omitempty"`
	WelcomeChannels []*sigil.WelcomeScreenChannel `json:"welcome_channels,omitempty"`
	Description     null.String                   `json:"description,omitempty"`
}

ModifyWelcomeScreenOptions configure the Guild's Welcome Screen.

Jump to

Keyboard shortcuts

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