Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Goscord/goscord
A Discord API wrapper written in Golang.
https://github.com/Goscord/goscord
bot discord discord-api discord-bot discord-wrapper discordapi golang udp websocket ws
Last synced: about 2 months ago
JSON representation
A Discord API wrapper written in Golang.
- Host: GitHub
- URL: https://github.com/Goscord/goscord
- Owner: Goscord
- License: mit
- Created: 2020-10-11T22:08:35.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-25T02:50:46.000Z (8 months ago)
- Last Synced: 2024-07-31T20:41:25.807Z (4 months ago)
- Topics: bot, discord, discord-api, discord-bot, discord-wrapper, discordapi, golang, udp, websocket, ws
- Language: Go
- Homepage: https://goscord.dev
- Size: 944 KB
- Stars: 72
- Watchers: 6
- Forks: 15
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- discord-api-libs - goscord - A Discord API wrapper written in Golang. (Libraries / Go)
README
Goscord is a package for Golang that provides high level bindings to the Discord API.
## Getting Started
### Installing
```sh
# Init the module:
go mod init# Install Goscord:
go get -u github.com/Goscord/goscord
```### Usage
Construct a new Discord client which can be used to access the variety of
Discord API functions and to set callback functions for Discord events.```go
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"
)var client *gateway.Session
func main() {
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) {
if msg.Content == "ping" {
client.Channel.SendMessage(msg.ChannelId, "Pong ! 🏓")
}
})client.Login()
select {}
}
```See [documentation](https://goscord.dev/documentation) for more detailed information.
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.