Categorygithub.com/LightningDev1/dgc
modulepackage
1.1.3
Repository: https://github.com/lightningdev1/dgc.git
Documentation: pkg.go.dev

# README

go.dev reference

dgc

A DiscordGo command router with tons of useful features If you find any bugs or if you have a feature request, please tell me using an issue.

Basic example

This just shows a very basic example:

func main() {
    // Discord bot logic here
    session, _ := ...

    // Create a new command router
    router := dgc.Create(&dgc.Router{
        Prefixes: []string{"!"},
    })

    // Register a simple ping command
    router.RegisterCmd(&dgc.Command{
        Name: "ping",
        Description: "Responds with 'pong!'",
        Usage: "ping",
        Example: "ping",
        IgnoreCase: true,
        Handler: func(ctx *dgc.Ctx) {
            ctx.RespondText("Pong!")
        },
    })

    // Initialize the router
    router.Initialize(session)
}

Usage

You can find examples for the more complex usage and all the integrated features in the examples/*.go files.

Arguments

To find out how you can use the integrated argument parser, just look into the examples/arguments.go file.

# Packages

No description provided by the author

# Functions

Create makes sure all maps get initialized.
NewRateLimiter creates a new rate limiter.
ParseArguments parses the raw string into several arguments.

# Variables

CodeblockLanguages defines which languages are valid codeblock languages.
RegexArguments defines the regex the argument string has to match.
RegexBigCodeblock defines the regex a big codeblock has to match.
RegexChannelMention defines the regex a channel mention has to match.
RegexRoleMention defines the regex a role mention has to match.
RegexSmallCodeblock defines the regex a small codeblock has to match.
RegexUserMention defines the regex a user mention has to match.

# Structs

Argument represents a single argument.
Arguments represents the arguments that may be used in a command context.
No description provided by the author
Codeblock represents a Discord codeblock.
Command represents a simple command.
Ctx represents the context for a command event.
DefaultRateLimiter represents an internal rate limiter.
No description provided by the author
ObjectsMap wraps a map[string]interface to provide thread safe access endpoints.
Router represents a DiscordGo command router.

# Interfaces

RateLimiter represents a general rate limiter.

# Type aliases

ExecutionHandler represents a handler for a context execution.
Middleware defines how a middleware looks like.