dgc

package module
v0.0.0-...-c853294 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MPL-2.0 Imports: 2 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

dgc = DiscordGo Common

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Session *dg.Session
}

func NewClient

func NewClient(s *dg.Session) *Client

NewClient creates and initializes a new client using s as its session.

func (*Client) Channel

func (c *Client) Channel(channelID string) (*dg.Channel, error)

Channel returns a channel based on the specific channel ID. Tries to use the local cache, if that fails, makes an API call.

func (*Client) Guild

func (c *Client) Guild(guildID string) (*dg.Guild, error)

Guild returns a guild based on the specific guild ID. Tries to use the local cache, if that fails, makes an API call.

func (*Client) Member

func (c *Client) Member(guildID, userID string) (*dg.Member, error)

Member returns a guild's member based on the specific guild and user IDs. Tries to use the local cache, if that fails, makes an API call.

func (*Client) MemberAllowed

func (c *Client) MemberAllowed(guildID, userID string, perms int64) (bool, error)

MemberAllowed returns true iff:

  • guildID is empty (aka a DM)
  • all the user's roles, combined as one, have all permissions in the perms bitfield
  • any of the user's roles has the administrator permission
  • the user is the owner of the guild

func (*Client) Role

func (c *Client) Role(guildID, roleID string) (*dg.Role, error)

Role returns a role based on the specific guild and role IDs. Tries to use the local cache, if that fails, makes an API call.

func (*Client) VoiceJoin

func (c *Client) VoiceJoin(guildID, userID string) (*dg.VoiceConnection, error)

VoiceJoin joins the same voice channel in guild as user.

func (*Client) VoiceState

func (c *Client) VoiceState(guildID, userID string) (*dg.VoiceState, error)

VoiceState returns a voice state by guild and user ID. Tries to use the local cache, if that fails, makes an API call.

Jump to

Keyboard shortcuts

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