forked from andersfylling/disgord
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsession.go
More file actions
47 lines (38 loc) · 1.76 KB
/
session.go
File metadata and controls
47 lines (38 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package disgord
import (
"context"
"time"
"github.com/andersfylling/disgord/internal/logger"
)
// Session Is the runtime interface for Disgord. It allows you to interact with a live session (using sockets or not).
// Note that this interface is used after you've configured Disgord, and therefore won't allow you to configure it
// further.
type Session interface {
// Logger returns the injected logger instance. If nothing was injected, a empty wrapper is returned
// to avoid nil panics.
Logger() logger.Logger
// HeartbeatLatency returns the avg. ish time used to send and receive a heartbeat signal.
// The latency is calculated as such:
// 0. start timer (start)
// 1. send heartbeat signal
// 2. wait until a heartbeat ack is sent by Discord
// 3. latency = time.Now().Sub(start)
// 4. avg = (avg + latency) / 2
//
// This feature was requested. But should never be used as a proof for delay between client and Discord.
AvgHeartbeatLatency() (duration time.Duration, err error)
// returns the latency for each given shard id. shardID => latency
HeartbeatLatencies() (latencies map[uint]time.Duration, err error)
RESTRatelimitBuckets() (group map[string][]string)
// AddPermission is to store the permissions required by the bot to function as intended.
AddPermission(permission PermissionBit) (updatedPermissions PermissionBit)
GetPermissions() (permissions PermissionBit)
Pool() *pools
ClientQueryBuilder
EditInteractionResponse(ctx context.Context, interaction *InteractionCreate, message *Message) error
SendInteractionResponse(context context.Context, interaction *InteractionCreate, data *InteractionResponse) error
// Status update functions
UpdateStatus(s *UpdateStatusPayload) error
UpdateStatusString(s string) error
GetConnectedGuilds() []Snowflake
}