We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2b2b5f1 commit 4b8d69aCopy full SHA for 4b8d69a
bot/commands/cmd_wiki.go
@@ -26,6 +26,13 @@ const (
26
algoliaInsights = false
27
)
28
29
+func truncateText(s string, max int) string {
30
+ if max > len(s) {
31
+ return s
32
+ }
33
+ return s[:strings.LastIndex(s[:max], " ")] + " ..."
34
+}
35
+
36
func (cm *CommandManager) commandWiki(
37
interaction *discordgo.InteractionCreate,
38
args map[string]*discordgo.ApplicationCommandInteractionDataOption,
@@ -123,7 +130,7 @@ func (cm *CommandManager) commandWiki(
123
130
hitData["url_without_anchor"].(string),
124
131
stringParts[len(stringParts)-3],
125
132
stringParts[len(stringParts)-2],
126
- description,
133
+ truncateText(description, 200),
127
134
))
128
135
}
129
136
0 commit comments