Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add websockets #12

Merged
merged 45 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a653443
add connect to gateway
t-rog Jun 1, 2022
548f8b3
add Reconn and Terminate
t-rog Jun 2, 2022
a0d5b63
Merge branch 'main' into pr/12
Jun 4, 2022
3791046
add event handler outline
Jun 4, 2022
103ec9a
fix semantics for implementation
Jun 4, 2022
8ab6533
add heartbeat func
t-rog Jun 5, 2022
fea6b53
add event handler generation
Jun 5, 2022
554b0a4
add listen func
t-rog Jun 6, 2022
932aecb
fix connect and disconnect func
Jun 7, 2022
cdac89b
fix heartbeat func
Jun 7, 2022
883e4ff
implement mutex
Jun 9, 2022
f540536
change heartbeat algorithm
Jun 10, 2022
6f692f0
fix heartbeat edge case
Jun 10, 2022
21159b3
review changes
Jun 12, 2022
78932a0
add mutex to event generation
Jun 12, 2022
580f12d
add listen optimization note
t-rog Jun 12, 2022
e4255ec
add automatic intent calculation
Jun 14, 2022
6bde6c0
fix opcode marshal
Jun 14, 2022
db50829
add Remove func
Jun 14, 2022
b045a1b
format
Jun 14, 2022
ede8e61
refactor session errors
Jun 15, 2022
6ca0e03
fix client initialization
Jun 15, 2022
1d03636
fix Client pointer init
Jun 21, 2022
47c3d95
fix Connect with test
t-rog Jun 21, 2022
890147f
fix token variable
t-rog Jun 21, 2022
6cc950a
Merge branch 'main' into pr/12
Jun 25, 2022
07aadbd
add event handler test
Jun 25, 2022
e7b619c
fix websocket errors
t-rog Jul 11, 2022
4eff3b6
fix handle function
Jul 11, 2022
e48e3c0
edit requested changes
t-rog Jul 11, 2022
0f2ac0f
fix test data race
t-rog Jul 12, 2022
1b4cf60
refactor websocket functionality
Jul 13, 2022
5699093
swap dasgo
Jul 13, 2022
2cc72e3
changefix heartbeat algorithm
Jul 13, 2022
9a731b5
add reconnect test
Jul 13, 2022
cebb014
refactor connect disconnect reconnect
Jul 14, 2022
edc06a7
update errors
Jul 14, 2022
ec55954
Merge branch 'main' into pr/12
Jul 14, 2022
f6aef2f
update contributing
Jul 14, 2022
967f5c3
update ci
Jul 14, 2022
57120da
fix ci
Jul 14, 2022
34b7e44
remove godotenv
Jul 14, 2022
bd1e39f
fix ci again
Jul 14, 2022
c175151
debug ci
Jul 14, 2022
a608b81
fix ci on forks
Jul 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ _gen/input*
!_gen/tools/*
!_gen/gen.exe

# Environment Variables
.env
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ bot := disgo.Client{
Authentication: disgo.BotToken("TOKEN"),
Authorization: &disgo.Authorization{ ... },
Config: disgo.DefaultConfig(),
Handlers: new(disgo.Handlers),
}
```

Expand Down Expand Up @@ -93,6 +94,8 @@ bot.Handle(disgo.FlagGatewayEventNameInteractionCreate, func(i disgo.Interaction
})
```

_Disgo provides automatic intent calculation._

### Output

Open a WebSocket **Session** to receive events.
Expand Down
Binary file modified _gen/gen.exe
Binary file not shown.
14 changes: 10 additions & 4 deletions _gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,23 @@ func generate() error {
return fmt.Errorf("chdir error (send): %w", err)
}

sendgen := exec.Command("copygen", "-yml", "wrapper/copygen/setup/setup.yml", "-xm")
sendgen := exec.Command("copygen", "-yml", "wrapper/copygen/requests/setup.yml", "-xm")
std, err := sendgen.CombinedOutput()
if err != nil {
return fmt.Errorf("copygen error (send): %v", string(std))
}

if err := os.Chdir(exeDir); err != nil {
return fmt.Errorf("chdir error (send): %w", err)
// events
handlegen := exec.Command("copygen", "-yml", "wrapper/copygen/events/setup.yml", "-xm")
std, err = handlegen.CombinedOutput()
if err != nil {
return fmt.Errorf("copygen error (handle): %v", string(std))
}

// events
// reset
if err := os.Chdir(exeDir); err != nil {
return fmt.Errorf("chdir error (generate): %w", err)
}

// clean
data, err := os.ReadFile(outputDasgo)
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ require (
github.com/goccy/go-json v0.9.6
github.com/gorilla/schema v1.2.0
github.com/valyala/fasthttp v1.35.0
nhooyr.io/websocket v1.8.7
)

require (
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/joho/godotenv v1.4.0 // indirect
github.com/klauspost/compress v1.15.1 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
)
60 changes: 60 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,12 +1,60 @@
github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY=
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14=
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY=
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo=
github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8=
github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo=
github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
github.com/goccy/go-json v0.9.6 h1:5/4CtRQdtsX0sal8fdVhTaiMN01Ri8BExZZ8iRmHQ6E=
github.com/goccy/go-json v0.9.6/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.5 h1:F768QJ1E9tib+q5Sc8MkdJi1RxLTbRcTf8LJV56aRls=
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/gorilla/schema v1.2.0 h1:YufUaxZYCKGFuAq3c96BOhjgd5nmXiOY9NGzF247Tsc=
github.com/gorilla/schema v1.2.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU=
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.15.1 h1:y9FcTHGyrebwfP0ZZqFiaxTaiDnUrGkJkI+f583BL1A=
github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.35.0 h1:wwkR8mZn2NbigFsaw2Zj5r+xkmzjbrA/lyTmiSlal/Y=
Expand All @@ -15,13 +63,25 @@ github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7Fw
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 h1:xHms4gcpe1YE7A3yIllJXP16CMAGuqwO2lX1mTyyRRc=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g=
nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
49 changes: 44 additions & 5 deletions wrapper/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,44 @@ type Client struct {
// Authorization contains parameters required to authorize a client's access to resources.
Authorization *Authorization

// Sessions contains sessions a bot uses to interact with the Discord Gateway.
Sessions []*Session

// Handlers represents a bot's event handlers.
Handlers *Handlers

// Config represents parameters used to perform various actions by the client.
Config *Config
}

// Authentication represents authentication parameters required to authenticate the bot.
// https://discord.com/developers/docs/reference#authentication
type Authentication struct {
// Token represents the Authentication Token used to authenticate the bot.
Token string

// TokenType represents the type of the Authentication Token.
TokenType string

// Header represents a Token Authorization Header.
Header string
}

// BotToken generates a Bot Token Authorization Header.
// BotToken uses a given token to return a valid Authentication Object for a bot token type.
func BotToken(token string) *Authentication {
return &Authentication{
Header: "Bot " + token,
Token: token,
TokenType: "Bot",
Header: "Bot " + token,
}
}

// BearerToken generates a Bearer Token Authorization Header.
// BearerToken uses a given token to return a valid Authentication Object for a bearer token type.
func BearerToken(token string) *Authentication {
return &Authentication{
"Bearer" + token,
Token: token,
TokenType: "Bearer",
Header: "Bearer" + token,
}
}

Expand Down Expand Up @@ -81,20 +97,43 @@ type Config struct {

// Retries represents the amount of time a request will retry a bad gateway.
Retries int

// GatewayPresenceUpdate represents the presence or status update of a bot.
//
// GatewayPresenceUpdate is used when the bot connects to a session.
//
// https://discord.com/developers/docs/topics/gateway#update-presence
GatewayPresenceUpdate *GatewayPresenceUpdate

// Intents represents a Discord Gateway Intent.
//
// You must specify a Gateway Intent in order to gain access to Events.
//
// https://discord.com/developers/docs/topics/gateway#gateway-intents
Intents BitFlag

// IntentSet represents a set of Discord Gateway Intents, that a bot needs
// to gain access to Events (and specific Event Information).
//
// IntentSet is used for automatic intent calculation when a user adds an event handler.
IntentSet map[BitFlag]bool
}

// Default Configuration Values.
const (
defaultUserAgent = "DiscordBot (https://github.com/switchupcb/disgo, " + "v" + VersionDiscordAPI + ")"
defaultUserAgent = "DiscordBot (https://" + module + ", v" + VersionDiscordAPI + ")"
defaultRequestTimeout = time.Second * 3
)

// DefaultConfig returns a default client configuration.
func DefaultConfig() *Config {
c := new(Config)
c.Client = new(fasthttp.Client)
c.Client.Name = defaultUserAgent
c.Timeout = defaultRequestTimeout
c.Retries = 1
c.IntentSet = make(map[BitFlag]bool)
c.GatewayPresenceUpdate = new(GatewayPresenceUpdate)

return c
}
27 changes: 27 additions & 0 deletions wrapper/copygen/events/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Events

The following steps are required to add an event.

1. Define the event object in [dasgo](https://github.com/switchupcb/dasgo).

```go
// Hello Structure
// https://discord.com/developers/docs/topics/gateway#hello-hello-structure
type Hello struct {
HeartbeatInterval time.Duration `json:"heartbeat_interval,omitempty"`
}
```

2. Define the event name in [dasgo `events.go`](https://github.com/switchupcb/dasgo/blob/main/dasgo/events.go).

3. Define the return values in [`copygen/events/setup.go`](/wrapper/copygen/events/setup.go).
```go
// Copygen defines the functions that will be generated.
type Copygen interface {
Hello(*disgo.Hello)
}
```

1. Generate the `Handlers` struct, `Handle` and `handle` functions using [`gen -d`](/_gen/README.md).

View the output in [`handle.go`](/wrapper/handle.go).
117 changes: 117 additions & 0 deletions wrapper/copygen/events/setup.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
package wrapper

import (
disgo "github.com/switchupcb/disgo/wrapper"
)

// Copygen defines the functions that will be generated.
type Copygen interface {
Hello(*disgo.Hello)
Ready(*disgo.Ready)
Resumed(*disgo.Resumed)
Reconnect(*disgo.Reconnect)
InvalidSession(*disgo.InvalidSession)
ApplicationCommandPermissionsUpdate(*disgo.ApplicationCommandPermissionsUpdate)
InteractionCreate(*disgo.InteractionCreate)
VoiceServerUpdate(*disgo.VoiceServerUpdate)
GuildMembersChunk(*disgo.GuildMembersChunk)
UserUpdate(*disgo.UserUpdate)
// intents FlagIntentGUILDS
ChannelCreate(*disgo.ChannelCreate)
// intents FlagIntentGUILDS
ChannelUpdate(*disgo.ChannelUpdate)
// intents FlagIntentGUILDS
ChannelDelete(*disgo.ChannelDelete)
// intents FlagIntentGUILDS FlagIntentDIRECT_MESSAGES
ChannelPinsUpdate(*disgo.ChannelPinsUpdate)
// intents FlagIntentGUILDS
ThreadCreate(*disgo.ThreadCreate)
// intents FlagIntentGUILDS
ThreadUpdate(*disgo.ThreadUpdate)
// intents FlagIntentGUILDS
ThreadDelete(*disgo.ThreadDelete)
// intents FlagIntentGUILDS
ThreadListSync(*disgo.ThreadListSync)
// intents FlagIntentGUILDS
ThreadMemberUpdate(*disgo.ThreadMemberUpdate)
// intents FlagIntentGUILDS FlagIntentGUILD_MEMBERS
ThreadMembersUpdate(*disgo.ThreadMembersUpdate)
// intents FlagIntentGUILDS
GuildCreate(*disgo.GuildCreate)
// intents FlagIntentGUILDS
GuildUpdate(*disgo.GuildUpdate)
// intents FlagIntentGUILDS
GuildDelete(*disgo.GuildDelete)
// intents FlagIntentGUILD_BANS
GuildBanAdd(*disgo.GuildBanAdd)
// intents FlagIntentGUILD_BANS
GuildBanRemove(*disgo.GuildBanRemove)
// intents FlagIntentGUILD_EMOJIS_AND_STICKERS
GuildEmojisUpdate(*disgo.GuildEmojisUpdate)
// intents FlagIntentGUILD_EMOJIS_AND_STICKERS
GuildStickersUpdate(*disgo.GuildStickersUpdate)
// intents FlagIntentGUILD_INTEGRATIONS
GuildIntegrationsUpdate(*disgo.GuildIntegrationsUpdate)
// intents FlagIntentGUILD_MEMBERS
GuildMemberAdd(*disgo.GuildMemberAdd)
// intents FlagIntentGUILD_MEMBERS
GuildMemberRemove(*disgo.GuildMemberRemove)
// intents FlagIntentGUILD_MEMBERS
GuildMemberUpdate(*disgo.GuildMemberUpdate)
// intents FlagIntentGUILDS
GuildRoleCreate(*disgo.GuildRoleCreate)
// intents FlagIntentGUILDS
GuildRoleUpdate(*disgo.GuildRoleUpdate)
// intents FlagIntentGUILDS
GuildRoleDelete(*disgo.GuildRoleDelete)
// intents FlagIntentGUILD_SCHEDULED_EVENTS
GuildScheduledEventCreate(*disgo.GuildScheduledEventCreate)
// intents FlagIntentGUILD_SCHEDULED_EVENTS
GuildScheduledEventUpdate(*disgo.GuildScheduledEventUpdate)
// intents FlagIntentGUILD_SCHEDULED_EVENTS
GuildScheduledEventDelete(*disgo.GuildScheduledEventDelete)
// intents FlagIntentGUILD_SCHEDULED_EVENTS
GuildScheduledEventUserAdd(*disgo.GuildScheduledEventUserAdd)
// intents FlagIntentGUILD_SCHEDULED_EVENTS
GuildScheduledEventUserRemove(*disgo.GuildScheduledEventUserRemove)
// intents FlagIntentGUILD_INTEGRATIONS
IntegrationCreate(*disgo.IntegrationCreate)
// intents FlagIntentGUILD_INTEGRATIONS
IntegrationUpdate(*disgo.IntegrationUpdate)
// intents FlagIntentGUILD_INTEGRATIONS
IntegrationDelete(*disgo.IntegrationDelete)
// intents FlagIntentGUILD_INVITES
InviteCreate(*disgo.InviteCreate)
// intents FlagIntentGUILD_INVITES
InviteDelete(*disgo.InviteDelete)
// intents FlagIntentGUILD_MESSAGES FlagIntentDIRECT_MESSAGES
MessageCreate(*disgo.MessageCreate)
// intents FlagIntentGUILD_MESSAGES FlagIntentDIRECT_MESSAGES
MessageUpdate(*disgo.MessageUpdate)
// intents FlagIntentGUILD_MESSAGES FlagIntentDIRECT_MESSAGES
MessageDelete(*disgo.MessageDelete)
// intents FlagIntentGUILD_MESSAGES
MessageDeleteBulk(*disgo.MessageDeleteBulk)
// intents FlagIntentGUILD_MESSAGE_REACTIONS FlagIntentDIRECT_MESSAGE_REACTIONS
MessageReactionAdd(*disgo.MessageReactionAdd)
// intents FlagIntentGUILD_MESSAGE_REACTIONS FlagIntentDIRECT_MESSAGE_REACTIONS
MessageReactionRemove(*disgo.MessageReactionRemove)
// intents FlagIntentGUILD_MESSAGE_REACTIONS FlagIntentDIRECT_MESSAGE_REACTIONS
MessageReactionRemoveAll(*disgo.MessageReactionRemoveAll)
// intents FlagIntentGUILD_MESSAGE_REACTIONS FlagIntentDIRECT_MESSAGE_REACTIONS
MessageReactionRemoveEmoji(*disgo.MessageReactionRemoveEmoji)
// intents FlagIntentGUILD_PRESENCES
PresenceUpdate(*disgo.PresenceUpdate)
// intents FlagIntentGUILDS
StageInstanceCreate(*disgo.StageInstanceCreate)
// intents FlagIntentGUILDS
StageInstanceDelete(*disgo.StageInstanceDelete)
// intents FlagIntentGUILDS
StageInstanceUpdate(*disgo.StageInstanceUpdate)
// intents FlagIntentGUILD_MESSAGE_REACTIONS FlagIntentDIRECT_MESSAGE_TYPING
TypingStart(*disgo.TypingStart)
// intents FlagIntentGUILD_VOICE_STATES
VoiceStateUpdate(*disgo.VoiceStateUpdate)
// intents FlagIntentGUILD_WEBHOOKS
WebhooksUpdate(*disgo.WebhooksUpdate)
}
Loading