File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -149,3 +149,24 @@ import { UserStore } from "@moonlight-mod/wp/common_stores";
149149
150150console .log (UserStore .getCurrentUser ());
151151```
152+
153+ ## Modifying message content before it is sent
154+
155+ Remember to add ` commands ` to your manifest's dependencies and ` {ext: "commands", id: "commands"} ` to your Webpack module's dependencies.
156+
157+ ``` ts
158+ import Commands from " @moonlight-mod/wp/commands_commands" ;
159+
160+ Commands .registerLegacyCommand (" unique-id" , {
161+ // This can be a more specific regex, but this only tells it to run if it
162+ // finds anything that matches this regex within the message.
163+ // You will have to do your own extraction and processing if you want to do
164+ // something based on a specific string.
165+ match: / . * / ,
166+ action : (content , context ) => {
167+ // Modify the content
168+
169+ return {content };
170+ }
171+ })
172+ ```
You can’t perform that action at this time.
0 commit comments