Skip to content
This repository has been archived by the owner on Aug 10, 2022. It is now read-only.

Commit

Permalink
add aliases and fixes for some playground commands
Browse files Browse the repository at this point in the history
  • Loading branch information
itsMapleLeaf committed Nov 28, 2021
1 parent a004ef3 commit 5af338c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
],
"sideEffects": false,
"scripts": {
"dev": "pnpm -C playground run dev",
"dev": "npm-run-all --parallel --print-label --race dev-*",
"dev-playground": "pnpm -C playground run dev",
"dev-build": "pnpm build -- --watch",
"build": "tsup-node",
"typecheck": "tsc --noEmit",
"test": "jest --colors",
Expand Down
6 changes: 5 additions & 1 deletion playground/src/commands/reverse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ import type { Gatekeeper } from "@itsmapleleaf/gatekeeper"
export default function defineCommands(gatekeeper: Gatekeeper) {
gatekeeper.addMessageCommand({
name: "reverse message content",
aliases: ["rev"],
run(context) {
context.reply(() =>
context.targetMessage.content.split("").reverse().join(""),
(context.targetMessage.content || "no message content")
.split("")
.reverse()
.join(""),
)
},
})
Expand Down
3 changes: 2 additions & 1 deletion playground/src/commands/spongebob.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Gatekeeper } from "@itsmapleleaf/gatekeeper"

function spongebobify(text: string): string {
return [...text]
return [...(text || "no message content")]
.map((char, index) =>
index % 2 === 0 ? char.toLocaleLowerCase() : char.toLocaleUpperCase(),
)
Expand All @@ -11,6 +11,7 @@ function spongebobify(text: string): string {
export default function defineCommands(gatekeeper: Gatekeeper) {
gatekeeper.addMessageCommand({
name: "spongebob",
aliases: ["sb"],
run(context) {
context.reply(() => spongebobify(context.targetMessage.content))
},
Expand Down

0 comments on commit 5af338c

Please sign in to comment.