Skip to content
/ minidis Public

Simple application commands handler for discordgo.

License

Notifications You must be signed in to change notification settings

tbdsux/minidis

Repository files navigation

minidis

Simple slash commands handler for discordgo

This just wraps functions and is based from the examples provided by discordgo and this is made in order to make its api more readable and easier to maintain.

Install

This is usable for simple and basic commands but is still missing some of other features.

go get -u github.com/TheBoringDude/minidis

You can also use a simple boilerplate generator to kickstart a new discord bot project

go install github.com/TheBoringDude/minidis/cli/minidis@latest

Usage

package main

import (
    "fmt"
    "log"
    "os"

    "github.com/TheBoringDude/minidis"
    "github.com/bwmarrin/discordgo"
)

func main() {
    bot := minidis.New(os.Getenv("TOKEN"))

    // set intents
    bot.SetIntents(discordgo.IntentsGuilds | discordgo.IntentsGuildMessages)

    bot.OnReady(func(s *discordgo.Session, i *discordgo.Ready) {
        log.Println("Bot is ready!")
    })

    // simple command
    bot.AddCommand(minidis.SlashCommandProps{
        Command:     "ping",
        Description: "Simple ping command.",
        Execute: func(c *minidis.SlashContext) error {
            return c.ReplyString(fmt.Sprintf("Hello **%s**, pong?", c.Author.Username))
        },
    })

    bot.Run()
}

More examples...

© 2022 | TheBoringDude

Releases

No releases published

Packages

No packages published

Languages