mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-11-30 16:17:57 +00:00
all: Remove deprecated symbols
This commit is contained in:
parent
5a1837a094
commit
d2b70ebfa7
|
|
@ -29,7 +29,7 @@ func AdminOnly(ctx *bot.Context) func(interface{}) error {
|
|||
|
||||
func GuildOnly(ctx *bot.Context) func(interface{}) error {
|
||||
return func(ev interface{}) error {
|
||||
// Try and infer the GuildID.
|
||||
// Try and infer the GuildIDs.
|
||||
if guildID := infer.GuildID(ev); guildID.IsValid() {
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ func TestGuildOnly(t *testing.T) {
|
|||
}
|
||||
var middleware = GuildOnly(ctx)
|
||||
|
||||
t.Run("allow message with GuildID", func(t *testing.T) {
|
||||
t.Run("allow message with GuildIDs", func(t *testing.T) {
|
||||
var msg = &gateway.MessageCreateEvent{
|
||||
Message: discord.Message{
|
||||
ID: 3,
|
||||
|
|
|
|||
|
|
@ -95,15 +95,6 @@ type Gateway struct {
|
|||
// independently.
|
||||
WSTimeout time.Duration
|
||||
|
||||
// ReconnectTimeout is the timeout used during reconnection.
|
||||
// If the a connection to the gateway can't be established before the
|
||||
// duration passes, the Gateway will be closed and FatalErrorCallback will
|
||||
// be called.
|
||||
//
|
||||
// Setting this to 0 is equivalent to no timeout.
|
||||
//
|
||||
// Deprecated: It is recommended to use ReconnectAttempts instead.
|
||||
ReconnectTimeout time.Duration
|
||||
// ReconnectAttempts are the amount of attempts made to Reconnect, before
|
||||
// aborting. If this set to 0, unlimited attempts will be made.
|
||||
ReconnectAttempts uint
|
||||
|
|
@ -262,29 +253,14 @@ func (g *Gateway) HasIntents(intents Intents) bool {
|
|||
}
|
||||
|
||||
// Close closes the underlying Websocket connection, invalidating the session
|
||||
// ID. A new gateway connection can be established, by calling Open again.
|
||||
// ID.
|
||||
//
|
||||
// If the wsutil.Connection of the Gateway's WS implements
|
||||
// wsutil.GracefulCloser, such as the default one, Close will send a closing
|
||||
// frame before ending the connection, closing it gracefully. This will cause
|
||||
// the bot to appear as offline instantly.
|
||||
// It will send a closing frame before ending the connection, closing it
|
||||
// gracefully. This will cause the bot to appear as offline instantly.
|
||||
func (g *Gateway) Close() error {
|
||||
return g.close(true)
|
||||
}
|
||||
|
||||
// CloseGracefully attempts to close the gateway connection gracefully, by
|
||||
// sending a closing frame before ending the connection. This will cause the
|
||||
// gateway's session id to be rendered invalid.
|
||||
//
|
||||
// Note that a graceful closure is only possible, if the wsutil.Connection of
|
||||
// the Gateway's Websocket implements wsutil.GracefulCloser.
|
||||
//
|
||||
// Deprecated: Close behaves identically to CloseGracefully, and should be used
|
||||
// instead.
|
||||
func (g *Gateway) CloseGracefully() error {
|
||||
return g.Close()
|
||||
}
|
||||
|
||||
// Pause pauses the Gateway connection, by ending the connection without
|
||||
// sending a closing frame. This allows the connection to be resumed at a later
|
||||
// point, by calling Reconnect or ReconnectCtx.
|
||||
|
|
@ -342,19 +318,10 @@ func (g *Gateway) SessionID() string {
|
|||
return g.sessionID
|
||||
}
|
||||
|
||||
// Reconnect tries to reconnect to the Gateway until the ReconnectAttempts or
|
||||
// ReconnectTimeout is reached.
|
||||
// Reconnect tries to reconnect to the Gateway until the ReconnectAttempts are
|
||||
// reached.
|
||||
func (g *Gateway) Reconnect() {
|
||||
ctx := context.Background()
|
||||
|
||||
if g.ReconnectTimeout > 0 {
|
||||
var cancel func()
|
||||
ctx, cancel = context.WithTimeout(context.Background(), g.ReconnectTimeout)
|
||||
|
||||
defer cancel()
|
||||
}
|
||||
|
||||
g.ReconnectCtx(ctx)
|
||||
g.ReconnectCtx(context.Background())
|
||||
}
|
||||
|
||||
// ReconnectCtx attempts to Reconnect until context expires.
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ func ConvertSupplementalMember(sm SupplementalMember) discord.Member {
|
|||
}
|
||||
|
||||
// ConvertSupplementalPresence converts a SupplementalPresence to a regular
|
||||
// Presence with an empty GuildID.
|
||||
// Presence with an empty GuildIDs.
|
||||
func ConvertSupplementalPresence(sp SupplementalPresence) Presence {
|
||||
return Presence{
|
||||
User: discord.User{ID: sp.UserID},
|
||||
|
|
|
|||
|
|
@ -625,7 +625,7 @@ func (s *State) Messages(channelID discord.ChannelID) ([]discord.Message, error)
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// New messages fetched weirdly does not have GuildID filled. We'll try and
|
||||
// New messages fetched weirdly does not have GuildIDs filled. We'll try and
|
||||
// get it for consistency with incoming message creates.
|
||||
var guildID discord.GuildID
|
||||
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ import (
|
|||
|
||||
var (
|
||||
// ErrMissingForIdentify is an error when we are missing information to identify.
|
||||
ErrMissingForIdentify = errors.New("missing GuildID, UserID, SessionID, or Token for identify")
|
||||
ErrMissingForIdentify = errors.New("missing GuildIDs, UserID, SessionID, or Token for identify")
|
||||
|
||||
// ErrMissingForResume is an error when we are missing information to resume.
|
||||
ErrMissingForResume = errors.New("missing GuildID, SessionID, or Token for resuming")
|
||||
ErrMissingForResume = errors.New("missing GuildIDs, SessionID, or Token for resuming")
|
||||
)
|
||||
|
||||
// OPCode 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue