- Notifications
You must be signed in to change notification settings - Fork16
A Discord API wrapper written in Golang.
License
NotificationsYou must be signed in to change notification settings
Goscord/goscord
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Goscord is a package forGolang that provides high level bindings to theDiscord API.
# Init the module:go mod init<url># Install Goscord:go get -u github.com/Goscord/goscord
Construct a new Discord client which can be used to access the variety ofDiscord API functions and to set callback functions for Discord events.
package mainimport ("fmt""github.com/Goscord/goscord/goscord""github.com/Goscord/goscord/goscord/discord""github.com/Goscord/goscord/goscord/gateway""github.com/Goscord/goscord/goscord/gateway/event")varclient*gateway.Sessionfuncmain() {fmt.Println("Starting...")client:=goscord.New(&gateway.Options{Token:"token",Intents:gateway.IntentGuildMessages, })client.On(event.EventReady,func() {fmt.Println("Logged in as "+client.Me().Tag()) })client.On(event.EventMessageCreate,func(msg*discord.Message) {ifmsg.Content=="ping" {client.Channel.SendMessage(msg.ChannelId,"Pong ! 🏓") } })client.Login()select {}}
Seedocumentation for more detailed information.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
About
A Discord API wrapper written in Golang.
Topics
Resources
License
Stars
Watchers
Forks
Releases
No releases published