Skip to content

Commit

Permalink
feat(funbox): add instant messaging (@fehmer) (#5850)
Browse files Browse the repository at this point in the history
Thanks
  • Loading branch information
fehmer authored Sep 5, 2024
1 parent b8ca187 commit 77c1e8e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
7 changes: 7 additions & 0 deletions backend/src/constants/funbox-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,13 @@ const FunboxList: MonkeyTypes.FunboxMetadata[] = [
frontendFunctions: ["alterText"],
name: "ddoouubblleedd",
},
{
canGetPb: false,
difficultyLevel: 1,
properties: ["changesCapitalisation"],
frontendFunctions: ["alterText"],
name: "instant_messaging",
},
];

export default FunboxList;
5 changes: 5 additions & 0 deletions frontend/src/ts/test/funbox/funbox-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ const list: MonkeyTypes.FunboxMetadata[] = [
info: "TTyyppee eevveerryytthhiinngg ttwwiiccee..",
properties: ["noLigatures"],
},
{
name: "instant_messaging",
info: "Who needs shift anyway?",
properties: ["changesCapitalisation"],
},
];

export function getAll(): MonkeyTypes.FunboxMetadata[] {
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/ts/test/funbox/funbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,16 @@ FunboxList.setFunboxFunctions("ddoouubblleedd", {
},
});

FunboxList.setFunboxFunctions("instant_messaging", {
alterText(word: string): string {
return word
.toLowerCase()
.replace(/[.!?]$/g, "\n") //replace .?! with enter
.replace(/[().'"]/g, "") //remove special characters
.replace(/\n+/g, "\n"); //make sure there is only one enter
},
});

export function toggleScript(...params: string[]): void {
FunboxList.get(Config.funbox).forEach((funbox) => {
if (funbox.functions?.toggleScript) funbox.functions.toggleScript(params);
Expand Down
5 changes: 5 additions & 0 deletions frontend/static/funbox/_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,10 @@
"name": "ddoouubblleedd",
"info": "TTyyppee eevveerryytthhiinngg ttwwiiccee..",
"canGetPb": true
},
{
"name": "instant_messaging",
"info": "Who needs shift anyway?",
"canGetPb": false
}
]

0 comments on commit 77c1e8e

Please sign in to comment.