Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add instant messaging funbox (@fehmer) #5850

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
]
Loading