Plugin
ShowHiddenThings
Displays various hidden & moderator-only things regardless of permissions.
1
import { definePluginSettings } from "@api/Settings";2
import { Devs } from "@utils/constants";3
import { Logger } from "@utils/Logger";4
import definePlugin, { OptionType, PluginSettingDef } from "@utils/types";5
import { GuildMember, Role } from "@vencord/discord-types";6
7
const opt = (description: string) => ({8
type: OptionType.BOOLEAN,9
description,10
default: true,11
restartNeeded: true12
} satisfies PluginSettingDef);13
14
const settings = definePluginSettings({15
showTimeouts: opt("Show member timeout icons in chat."),16
showInvitesPaused: opt("Show the invites paused tooltip in the server list."),17
showModView: opt("Show the member mod view context menu item in all servers.")18
});19
20
export default definePlugin({21
name: "ShowHiddenThings",22
searchTerms: ["ShowTimeouts", "ShowInvitesPaused", "ShowModView", "DisableDiscoveryFilters"],23
description: "Displays various hidden & moderator-only things regardless of permissions.",24
tags: ["Servers", "Utility"],25
authors: [Devs.Dolfies],26
settings,27
28
patches: [29
{30
find: "showCommunicationDisabledStyles",31
predicate: () => settings.store.showTimeouts,32
replacement: {33
match: /&&\i\.\i\.canManageUser\(\i\.\i\.MODERATE_MEMBERS,\i\.author,\i\)/,34
replace: "",35
},36
},37
{38
find: "INVITES_DISABLED)||",39
predicate: () => settings.store.showInvitesPaused,40
replacement: {41
match: /\i\.\i\.can\(\i\.\i.MANAGE_GUILD,\i\)/,42
replace: "true",43
},44
},45
{46
find: /,checkElevated:!1}\),\i\.\i\)}(?<=getCurrentUser\(\);return.+?)/,47
predicate: () => settings.store.showModView,48
replacement: {49
match: /return \i\.\i\(\i\.\i\(\{user:\i,context:\i,checkElevated:!1\}\),\i\.\i\)/,50
replace: "return true",51
}52
},53
// fixes a bug where Members page must be loaded to see highest role, why is Discord depending on MemberSafetyStore.getEnhancedMember for something that can be obtained here?54
{55
find: "#{intl::GUILD_MEMBER_MOD_VIEW_HIGHEST_ROLE}),children:",56
predicate: () => settings.store.showModView,57
replacement: {58
match: /(#{intl::GUILD_MEMBER_MOD_VIEW_HIGHEST_ROLE}.{0,80})role:\i(?<=\[\i\.roles,\i\.highestRoleId,(\i)\].+?)/,59
replace: (_, rest, roles) => `${rest}role:$self.getHighestRole(arguments[0],${roles})`,60
}61
},62
// allows you to open mod view on yourself63
{64
find: 039;action:"PRESS_MOD_VIEW",icon:039;,65
predicate: () => settings.store.showModView,66
replacement: {67
match: /\i(?=\?null)/,68
replace: "false"69
}70
}71
],72
73
getHighestRole({ member }: { member: GuildMember; }, roles: Role[]): Role | undefined {74
try {75
return roles.find(role => role.id === member.highestRoleId);76
} catch (e) {77
new Logger("ShowHiddenThings").error("Failed to find highest role", e);78
return undefined;79
}80
}81
});82