MCPcopy Create free account
hub / github.com/esmBot/esmBot / paramsFunc

Method paramsFunc

commands/image-editing/caption2.js:28–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26
27class CaptionTwoCommand extends MediaCommand {
28 paramsFunc() {
29 const newArgs = this.getOptionString("text") ?? this.args.join(" ");
30 const font = this.getOptionString("font");
31 return {
32 caption: newArgs?.trim()
33 ? this.clean(newArgs)
34 : words
35 .sort(() => 0.5 - Math.random())
36 .slice(0, Math.floor(Math.random() * words.length + 1))
37 .join(" "),
38 top: !!this.getOptionBoolean("top"),
39 // @ts-expect-error this.constructor allows us to get static properties, but TS interprets it as a pure function
40 font: font && this.constructor.allowedFonts.includes(font.toLowerCase()) ? font.toLowerCase() : "helvetica",
41 };
42 }
43
44 static init() {
45 super.init();

Callers

nothing calls this directly

Calls 4

getOptionStringMethod · 0.80
trimMethod · 0.80
cleanMethod · 0.80
getOptionBooleanMethod · 0.80

Tested by

no test coverage detected