Skip to content

Commit

Permalink
chatTweaks: add app to bot and webhook tag
Browse files Browse the repository at this point in the history
theres settings for no blocked/ignored messages and jump to
blocked/ignored but not implemented, work check in commit
  • Loading branch information
Cynosphere committed Jan 5, 2025
1 parent ab1d007 commit 18aa8e2
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
32 changes: 31 additions & 1 deletion src/chatTweaks/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Patch } from "@moonlight-mod/types";

let webhookTag = () => moonlight.getConfigOption<boolean>("chatTweaks", "webhookTag") ?? true;

export const patches: Patch[] = [
// no reply mention
{
Expand All @@ -19,6 +21,34 @@ export const patches: Patch[] = [
replacement: (_, showThreadPromptOnReply) =>
`=(moonlight.getConfigOption("chatTweaks","noReplyChainNag")??true?false:${showThreadPromptOnReply})&&`
}
},

// revert app to bot
{
find: ".BOT:default:",
replace: {
match: "9RNkeH", // APP_TAG
replacement: "PQt9z8" // BOT_TAG_BOT
},
prerequisite: () => moonlight.getConfigOption<boolean>("chatTweaks", "appToBot") ?? true
},

// webhook tag
{
find: ".BOT:default:",
replace: {
match: /case .\..{1,3}\.BOT:default:(.)=/,
replacement: (orig, tag) => `case 99:${tag}="WEBHOOK";break;${orig}`
},
prerequisite: webhookTag
},
{
find: ".Types.ORIGINAL_POSTER",
replace: {
match: /(.)=.\.Z\.Types\.ORIGINAL_POSTER\),/,
replacement: (orig, type) =>
`${orig}(arguments[0].user?.bot&&arguments[0].message?.webhookId&&arguments[0].user?.isNonUserBot?.()&&(${type}=99)),`
},
prerequisite: webhookTag
}
];

28 changes: 27 additions & 1 deletion src/chatTweaks/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://moonlight-mod.github.io/manifest.schema.json",
"id": "chatTweaks",
"version": "1.0.0",
"version": "1.0.1",
"meta": {
"name": "Chat Tweaks",
"tagline": "Various tweaks to chatting. Every feature togglable.",
Expand Down Expand Up @@ -30,6 +30,32 @@
"description": "Removes the extra bar of text when replying to a chain of replies over 4 messages.",
"type": "boolean",
"default": true
},
"appToBot": {
"displayName": "App to Bot",
"description": "Revert bot tags back to saying bot",
"type": "boolean",
"default": true
},
"webhookTag": {
"displayName": "Webhook Tag",
"type": "boolean",
"default": true
},
"jumpToBlocked": {
"displayName": "Allow jumping to blocked/ignored messages",
"type": "boolean",
"default": true
},
"hideBlocked": {
"displayName": "Hide blocked messages completely",
"type": "boolean",
"default": false
},
"hideIgnored": {
"displayName": "Hide ignored messages completely",
"type": "boolean",
"default": false
}
},
"apiLevel": 2
Expand Down

0 comments on commit 18aa8e2

Please sign in to comment.