Giter Club home page Giter Club logo

goscord's Introduction

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 People

Contributors

bluzzi avatar deepsourcebot avatar djpiper28 avatar szerookii avatar tomoconnor avatar wdiogolo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

goscord's Issues

Discord Server issue

Hi, so i tried joining the goscord discord server, but when I joined I didn't see any channels (see screenshot). Could someone help? Or maybe report to the moderators?
Screenshot_2024-03-24-13-03-11-334_com discord-edit

Create Enum for Bot Events

Hi there,

In your discord bot, I found this example:

  _ = client.On("ready", event.OnReady(client, cmdManager))
  _ = client.On("interactionCreate", cmdManager.Handler(client))
  _ = client.On("guildMemberAdd", event.OnGuildMemberAdd(client))

and as a professional software developer I want to have a list of possible server events suggested by my ide, so I would suggest to create a custom type of string, so the code could look like this:

  import "github.com/Goscord/goscord/goscord/events"
  _ = client.On(events.EventReady, event.OnReady(client, cmdManager))
  _ = client.On(events.EventInteractionCreate, cmdManager.Handler(client))
  _ = client.On(events.EventGuildMemberAdd, event.OnGuildMemberAdd(client))

see in the node js documentation: https://discordjs.guide/creating-your-bot/event-handling.html#individual-event-files

cannot find module providing package due to -mod=readonly

Hi, still a noob on GoLang so not sure if this should rather go to StackOverflow but hope this isssue is placed correct here.

After installing the package, I copied over the example from the https://goscord.dev/ main page I get error:
error while importing github.com/Goscord/goscord/goscord: cannot find module providing package github.com/Goscord/goscord/goscord/discord/embed: import lookup disabled by -mod=readonly

Same error for the other imports
"github.com/Goscord/goscord/goscord/discord"
"github.com/Goscord/goscord/goscord/gateway"
"github.com/Goscord/goscord/goscord/gateway/event"
I am using Visual Studio Code.

Anyone has hints please?

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.