Skip to content

Commit 3245539

Browse files
committed
add things & add allowed mentions
1 parent 6ddacac commit 3245539

File tree

7 files changed

+4089
-6
lines changed

7 files changed

+4089
-6
lines changed

commands/read.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
"github.com/disgoorg/disgo/discord"
77
"github.com/disgoorg/disgo/handler"
8+
"github.com/disgoorg/snowflake/v2"
89
"go.deanishe.net/fuzzy"
910

1011
"github.com/lavalink-devs/lavalink-bot/internal/res"
@@ -37,6 +38,9 @@ func (c *Commands) Read(data discord.SlashCommandInteractionData, e *handler.Com
3738
user, ok := data.OptUser("user")
3839
if ok {
3940
msg.Content += fmt.Sprintf("Hey %s,\n", user.Mention())
41+
msg.AllowedMentions = &discord.AllowedMentions{
42+
Users: []snowflake.ID{user.ID},
43+
}
4044
}
4145

4246
thing, ok := c.Things[data.String("thing")]

lavalinkbot/thing.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"embed"
77
"fmt"
88
"io"
9-
"path/filepath"
9+
"path"
1010

1111
"github.com/adrg/frontmatter"
1212
)
@@ -22,15 +22,15 @@ func ReadThings(things embed.FS) (map[string]Thing, error) {
2222
if !file.IsDir() {
2323
continue
2424
}
25-
thingFiles, err := things.ReadDir(filepath.Join("things", file.Name()))
25+
thingFiles, err := things.ReadDir(path.Join("things", file.Name()))
2626
if err != nil {
2727
return nil, err
2828
}
2929

3030
var thing Thing
3131
for _, f := range thingFiles {
3232
if f.Name() == "index.md" {
33-
data, err := things.ReadFile(filepath.Join("things", file.Name(), "index.md"))
33+
data, err := things.ReadFile(path.Join("things", file.Name(), "index.md"))
3434
if err != nil {
3535
return nil, fmt.Errorf("failed to read index.md for %s: %w", file.Name(), err)
3636
}
@@ -47,7 +47,7 @@ func ReadThings(things embed.FS) (map[string]Thing, error) {
4747
continue
4848
}
4949

50-
data, err := things.ReadFile(filepath.Join("things", file.Name(), f.Name()))
50+
data, err := things.ReadFile(path.Join("things", file.Name(), f.Name()))
5151
if err != nil {
5252
return nil, fmt.Errorf("failed to read file %s for %s: %w", f.Name(), file.Name(), err)
5353
}

things/bee_movie_script/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
name: Bee Movie Script
3+
---

0 commit comments

Comments
 (0)