disgomd

module
v0.0.0-...-04b0558 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2022 License: GPL-3.0

README

Disgomd

Todo

  • write a readme :P
  • add slash commands support

Example usage

func main() {
	cli, err := disgo.New(os.Getenv("bot_token"),
		bot.WithGatewayConfigOpts(
			gateway.WithIntents(
				gateway.IntentGuildMessages,
				gateway.IntentMessageContent,
			),
		),
	)
	defer cli.Close(context.TODO())
	if err != nil {
		fmt.Println("Couldn't create client")
		os.Exit(1)
	}

	cmd.Init(cli, "!")
	cmd.Register(cmd.New("test", "just a test command", nil, TestCommand{}))

	err = cli.OpenGateway(context.TODO())
	if err != nil {
		fmt.Println("Couldn't open gateway")
		os.Exit(1)
	}

	s := make(chan os.Signal, 1)
	signal.Notify(s, syscall.SIGINT, syscall.SIGTERM, os.Interrupt)
	<-s
}

type TestCommand struct{}

func (TestCommand) Run(ctx cmd.Context) discord.MessageCreate {
	return discord.NewMessageCreateBuilder().
		SetContent("Hi this is a test message :)").Build()
}

thanks to dragonfly contributors for command system

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL