Skip to content

Commit

Permalink
updated database query command
Browse files Browse the repository at this point in the history
  • Loading branch information
GhomKrosmonaute committed Oct 7, 2023
1 parent 3dab2ca commit 864203d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/commands/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,18 @@ export default new app.Command({
app.code.stringify({
lang: "json",
format: { printWidth: 62 },
content: JSON.stringify(result).slice(0, 1000),
content: ((result) => {
if (!Array.isArray(result)) return JSON.stringify(result)

const copy = result.slice()

while (JSON.stringify(copy, null, 2).length > 4050) {
copy.splice(copy.indexOf("..."), 1)
copy.push("...")
}

return JSON.stringify(copy)
})(result),
})
)
.setFooter(`Result of : ${query}`),
Expand Down

0 comments on commit 864203d

Please sign in to comment.