Skip to content

Commit

Permalink
add changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
zekro committed Aug 16, 2022
1 parent 17e6b21 commit 2b82f20
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
[VERSION]

## Changes

### Message Component Implementation [#8]

You can now attach message components to messages and register interaction handlers
using the [ComponentHandler](https://pkg.go.dev/github.com/zekrotja/ken#ComponentHandler).

It provides a low level implementation to add components to messages and handlers directly
to the handler registry as well as a more sophisticated
[ComponentBuilder](https://pkg.go.dev/github.com/zekrotja/ken#ComponentBuilder) to simplify
the attachment and handling of message components.

#### Example

```go
err = fum.AddComponents().
AddActionsRow(func(b ken.ComponentAssembler) {
b.Add(discordgo.Button{
CustomID: "button-1",
Label: "Absolutely fantastic!",
}, func(ctx ken.ComponentContext) {
ctx.RespondEmbed(&discordgo.MessageEmbed{
Description: fmt.Sprintf("Responded to %s", ctx.GetData().CustomID),
})
}, !clearAll)
b.Add(discordgo.Button{
CustomID: "button-2",
Style: discordgo.DangerButton,
Label: "Not so well",
}, func(ctx ken.ComponentContext) {
ctx.RespondEmbed(&discordgo.MessageEmbed{
Description: fmt.Sprintf("Responded to %s", ctx.GetData().CustomID),
})
}, !clearAll)
}, clearAll).
Build()
```

You can find the complete example in [examples/components](examples/components).

### Guild Scopes [#11]

You can now scope commands to specific guilds by implementing the
[GuildScopedCommand](https://pkg.go.dev/github.com/zekrotja/ken#GuildScopedCommand) interface
in you command. Then, the command will only be registered for the guild returned by
the `Guild` method of the command.


#### Example

```go
type Guild1Command struct{}

var (
_ ken.SlashCommand = (*Guild1Command)(nil)
_ ken.GuildScopedCommand = (*Guild1Command)(nil)
)

func (c *Guild1Command) Name() string {
return "guild1"
}

func (c *Guild1Command) Guild() string {
return "362162947738566657"
}
```

You can find the complete example in [examples/guildscoped](examples/guildscoped).

## Update

```
go get -v -u github.com/zekrotja/ken@[VERSION]
```

0 comments on commit 2b82f20

Please sign in to comment.