Giter VIP home page Giter VIP logo

Goscord

Goscord is a package for Golang that provides high level bindings to the Discord API.

Getting Started

Installing

# Init the module:
go mod init <url> 

# 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.

package main

import (
    "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 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.

Goscord's Projects

backend icon backend

Backend of the website, used to generate the documentation from the Goscord code.

bot icon bot

An example of bot using Goscord.

goscord icon goscord

A Discord API wrapper written in Golang.

website icon website

Website of Goscord, written in TypeScript with React, Next and Tailwind frameworks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.