1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-03-24 10:59:18 +00:00

replace usage of discordapp.com with discord.com in docs

This commit is contained in:
mavolin 2020-11-03 18:16:42 +01:00 committed by diamondburned
parent 661f96da03
commit 88258b51c2
11 changed files with 31 additions and 31 deletions

View file

@ -15,7 +15,7 @@ const maxGuildFetchLimit = 100
var EndpointGuilds = Endpoint + "guilds/"
// https://discordapp.com/developers/docs/resources/guild#create-guild-json-params
// https://discord.com/developers/docs/resources/guild#create-guild-json-params
type CreateGuildData struct {
// Name is the name of the guild (2-100 characters)
Name string `json:"name"`
@ -247,7 +247,7 @@ func (c *Client) LeaveGuild(id discord.GuildID) error {
return c.FastRequest("DELETE", EndpointMe+"/guilds/"+id.String())
}
// https://discordapp.com/developers/docs/resources/guild#modify-guild-json-params
// https://discord.com/developers/docs/resources/guild#modify-guild-json-params
type ModifyGuildData struct {
// Name is the guild's name.
Name string `json:"name,omitempty"`

View file

@ -23,7 +23,7 @@ func (err ErrImageTooLarge) Error() string {
}
// Image wraps around the Data URI Scheme that Discord uses:
// https://discordapp.com/developers/docs/reference#image-data
// https://discord.com/developers/docs/reference#image-data
type Image struct {
// ContentType is optional and will be automatically detected. However, it
// should always return "image/jpeg," "image/png" or "image/gif".

View file

@ -35,7 +35,7 @@ const AttachmentSpoilerPrefix = "SPOILER_"
// Discord parse it completely, meaning they would be mutually exclusive with
// Roles and Users.
//
// https://discordapp.com/developers/docs/resources/channel#allowed-mentions-object
// https://discord.com/developers/docs/resources/channel#allowed-mentions-object
type AllowedMentions struct {
// Parse is an array of allowed mention types to parse from the content.
Parse []AllowedMentionType `json:"parse"`

View file

@ -4,7 +4,7 @@ import "github.com/diamondburned/arikawa/v2/discord"
// Rules: VOICE_STATE_UPDATE -> VoiceStateUpdateEvent
// https://discordapp.com/developers/docs/topics/gateway#connecting-and-resuming
// https://discord.com/developers/docs/topics/gateway#connecting-and-resuming
type (
HelloEvent struct {
HeartbeatInterval discord.Milliseconds `json:"heartbeat_interval"`
@ -18,7 +18,7 @@ type (
InvalidSessionEvent bool
)
// https://discordapp.com/developers/docs/topics/gateway#channels
// https://discord.com/developers/docs/topics/gateway#channels
type (
ChannelCreateEvent struct {
discord.Channel
@ -45,7 +45,7 @@ type (
}
)
// https://discordapp.com/developers/docs/topics/gateway#guilds
// https://discord.com/developers/docs/topics/gateway#guilds
type (
GuildCreateEvent struct {
discord.Guild
@ -205,7 +205,7 @@ type (
}
)
// https://discordapp.com/developers/docs/topics/gateway#messages
// https://discord.com/developers/docs/topics/gateway#messages
type (
MessageCreateEvent struct {
discord.Message
@ -261,7 +261,7 @@ type (
}
)
// https://discordapp.com/developers/docs/topics/gateway#presence
// https://discord.com/developers/docs/topics/gateway#presence
type (
// Clients may only update their game status 5 times per 20 seconds.
PresenceUpdateEvent struct {
@ -300,7 +300,7 @@ type (
}
)
// https://discordapp.com/developers/docs/topics/gateway#voice
// https://discord.com/developers/docs/topics/gateway#voice
type (
VoiceStateUpdateEvent struct {
discord.VoiceState
@ -312,7 +312,7 @@ type (
}
)
// https://discordapp.com/developers/docs/topics/gateway#webhooks
// https://discord.com/developers/docs/topics/gateway#webhooks
type (
WebhooksUpdateEvent struct {
GuildID discord.GuildID `json:"guild_id"`

View file

@ -237,7 +237,7 @@ func (g *Gateway) ReconnectCtx(ctx context.Context) (err error) {
// Condition: err == ErrInvalidSession:
// If the connection is rate limited (documented behavior):
// https://discordapp.com/developers/docs/topics/gateway#rate-limiting
// https://discord.com/developers/docs/topics/gateway#rate-limiting
// make sure we don't overwrite our last error
if err = g.OpenContext(ctx); err != nil {

View file

@ -3,7 +3,7 @@ package gateway
import "github.com/diamondburned/arikawa/v2/discord"
// Intents for the new Discord API feature, documented at
// https://discordapp.com/developers/docs/topics/gateway#gateway-intents.
// https://discord.com/developers/docs/topics/gateway#gateway-intents.
type Intents uint32
const (

View file

@ -147,7 +147,7 @@ func (s *Session) JoinChannelCtx(
channelID = cID
}
// https://discordapp.com/developers/docs/topics/voice-connections#retrieving-voice-server-information
// https://discord.com/developers/docs/topics/voice-connections#retrieving-voice-server-information
// Send a Voice State Update event to the gateway.
err := s.session.Gateway.UpdateVoiceStateCtx(ctx, gateway.UpdateVoiceStateData{
GuildID: gID,

View file

@ -47,7 +47,7 @@ func DialConnectionCtx(ctx context.Context, addr string, ssrc uint32) (*Connecti
return nil, errors.Wrap(err, "failed to dial host")
}
// https://discordapp.com/developers/docs/topics/voice-connections#ip-discovery
// https://discord.com/developers/docs/topics/voice-connections#ip-discovery
ssrcBuffer := [70]byte{
0x1, 0x2,
}
@ -77,7 +77,7 @@ func DialConnectionCtx(ctx context.Context, addr string, ssrc uint32) (*Connecti
ip := ipbody[:nullPos]
port := binary.LittleEndian.Uint16(ipBuffer[68:70])
// https://discordapp.com/developers/docs/topics/voice-connections#encrypting-and-sending-voice
// https://discord.com/developers/docs/topics/voice-connections#encrypting-and-sending-voice
packet := [12]byte{
0: 0x80, // Version + Flags
1: 0x78, // Payload Type

View file

@ -17,7 +17,7 @@ var (
)
// OPCode 0
// https://discordapp.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection-example-voice-identify-payload
// https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection-example-voice-identify-payload
type IdentifyData struct {
GuildID discord.GuildID `json:"server_id"` // yes, this should be "server_id"
UserID discord.UserID `json:"user_id"`
@ -53,7 +53,7 @@ func (c *Gateway) IdentifyCtx(ctx context.Context) error {
}
// OPCode 1
// https://discordapp.com/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection-example-select-protocol-payload
// https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection-example-select-protocol-payload
type SelectProtocol struct {
Protocol string `json:"protocol"`
Data SelectProtocolData `json:"data"`
@ -79,7 +79,7 @@ func (c *Gateway) SelectProtocolCtx(ctx context.Context, data SelectProtocol) er
}
// OPCode 3
// https://discordapp.com/developers/docs/topics/voice-connections#heartbeating-example-heartbeat-payload
// https://discord.com/developers/docs/topics/voice-connections#heartbeating-example-heartbeat-payload
// type Heartbeat uint64
// Heartbeat sends a Heartbeat operation (opcode 3) to the Gateway Gateway.
@ -95,7 +95,7 @@ func (c *Gateway) HeartbeatCtx(ctx context.Context) error {
return c.SendCtx(ctx, HeartbeatOP, time.Now().UnixNano())
}
// https://discordapp.com/developers/docs/topics/voice-connections#speaking
// https://discord.com/developers/docs/topics/voice-connections#speaking
type SpeakingFlag uint64
const (
@ -105,7 +105,7 @@ const (
)
// OPCode 5
// https://discordapp.com/developers/docs/topics/voice-connections#speaking-example-speaking-payload
// https://discord.com/developers/docs/topics/voice-connections#speaking-example-speaking-payload
type SpeakingData struct {
Speaking SpeakingFlag `json:"speaking"`
Delay int `json:"delay"`
@ -133,7 +133,7 @@ func (c *Gateway) SpeakingCtx(ctx context.Context, flag SpeakingFlag) error {
}
// OPCode 7
// https://discordapp.com/developers/docs/topics/voice-connections#resuming-voice-connection-example-resume-connection-payload
// https://discord.com/developers/docs/topics/voice-connections#resuming-voice-connection-example-resume-connection-payload
type ResumeData struct {
GuildID discord.GuildID `json:"server_id"` // yes, this should be "server_id"
SessionID string `json:"session_id"`

View file

@ -7,7 +7,7 @@ import (
)
// OPCode 2
// https://discordapp.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection-example-voice-ready-payload
// https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection-example-voice-ready-payload
type ReadyEvent struct {
SSRC uint32 `json:"ssrc"`
IP string `json:"ip"`
@ -28,7 +28,7 @@ func (r ReadyEvent) Addr() string {
}
// OPCode 4
// https://discordapp.com/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection-example-session-description-payload
// https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection-example-session-description-payload
type SessionDescriptionEvent struct {
Mode string `json:"mode"`
SecretKey [32]byte `json:"secret_key"`
@ -38,15 +38,15 @@ type SessionDescriptionEvent struct {
type SpeakingEvent SpeakingData
// OPCode 6
// https://discordapp.com/developers/docs/topics/voice-connections#heartbeating-example-heartbeat-ack-payload
// https://discord.com/developers/docs/topics/voice-connections#heartbeating-example-heartbeat-ack-payload
type HeartbeatACKEvent uint64
// OPCode 8
// https://discordapp.com/developers/docs/topics/voice-connections#heartbeating-example-hello-payload-since-v3
// https://discord.com/developers/docs/topics/voice-connections#heartbeating-example-hello-payload-since-v3
type HelloEvent struct {
HeartbeatInterval discord.Milliseconds `json:"heartbeat_interval"`
}
// OPCode 9
// https://discordapp.com/developers/docs/topics/voice-connections#resuming-voice-connection-example-resumed-payload
// https://discord.com/developers/docs/topics/voice-connections#resuming-voice-connection-example-resumed-payload
type ResumedEvent struct{}

View file

@ -70,7 +70,7 @@ type Gateway struct {
}
func New(state State) *Gateway {
// https://discordapp.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection
// https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection
var endpoint = "wss://" + strings.TrimSuffix(state.Endpoint, ":80") + "/?v=" + Version
return &Gateway{
@ -96,7 +96,7 @@ func (c *Gateway) OpenCtx(ctx context.Context) error {
return errors.New("missing endpoint in state")
}
// https://discordapp.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection
// https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection
var endpoint = "wss://" + strings.TrimSuffix(c.state.Endpoint, ":80") + "/?v=" + Version
wsutil.WSDebug("VoiceGateway: Connecting to voice endpoint (endpoint=" + endpoint + ")")
@ -162,7 +162,7 @@ func (c *Gateway) __start(ctx context.Context) error {
wsutil.WSDebug("VoiceGateway: Received Hello")
// https://discordapp.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection
// https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection
// Turns out Hello is sent right away on connection start.
if !c.reconnect.Get() {
if err := c.IdentifyCtx(ctx); err != nil {
@ -248,7 +248,7 @@ func (c *Gateway) ReconnectCtx(ctx context.Context) error {
// Condition: err == ErrInvalidSession:
// If the connection is rate limited (documented behavior):
// https://discordapp.com/developers/docs/topics/gateway#rate-limiting
// https://discord.com/developers/docs/topics/gateway#rate-limiting
if err := c.OpenCtx(ctx); err != nil {
return errors.Wrap(err, "failed to reopen gateway")