2023-09-05 19:42:35 +02:00
/ *
* Vencord , a modification for Discord ' s desktop app
* Copyright ( c ) 2023 Vendicated and contributors
*
* This program is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation , either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program . If not , see < https : //www.gnu.org/licenses/>.
* /
2024-12-07 23:55:37 +01:00
import { definePluginSettings } from "@api/Settings" ;
2023-09-05 19:42:35 +02:00
import { Devs } from "@utils/constants" ;
2024-07-13 19:14:22 +02:00
import definePlugin , { OptionType , PluginSettingDef } from "@utils/types" ;
const opt = ( description : string ) = > ( {
type : OptionType . BOOLEAN ,
description ,
default : true ,
restartNeeded : true
} satisfies PluginSettingDef ) ;
2023-09-05 19:42:35 +02:00
2024-04-23 01:46:11 +02:00
const settings = definePluginSettings ( {
2024-07-13 19:14:22 +02:00
showTimeouts : opt ( "Show member timeout icons in chat." ) ,
showInvitesPaused : opt ( "Show the invites paused tooltip in the server list." ) ,
2024-12-22 00:55:24 +01:00
showModView : opt ( "Show the member mod view context menu item in all servers." )
2024-04-23 01:46:11 +02:00
} ) ;
2023-09-05 19:42:35 +02:00
export default definePlugin ( {
2024-04-23 01:46:11 +02:00
name : "ShowHiddenThings" ,
2024-05-08 03:50:26 +02:00
tags : [ "ShowTimeouts" , "ShowInvitesPaused" , "ShowModView" , "DisableDiscoveryFilters" ] ,
2024-05-13 07:09:19 +02:00
description : "Displays various hidden & moderator-only things regardless of permissions." ,
2023-09-05 19:42:35 +02:00
authors : [ Devs . Dolfies ] ,
2024-12-22 00:55:24 +01:00
settings ,
2023-09-05 19:42:35 +02:00
patches : [
{
find : "showCommunicationDisabledStyles" ,
2024-04-23 01:46:11 +02:00
predicate : ( ) = > settings . store . showTimeouts ,
2023-09-05 19:42:35 +02:00
replacement : {
match : /&&\i\.\i\.canManageUser\(\i\.\i\.MODERATE_MEMBERS,\i\.author,\i\)/ ,
replace : "" ,
} ,
} ,
2024-04-23 01:46:11 +02:00
{
2024-08-13 06:50:17 +02:00
find : "INVITES_DISABLED))||" ,
2024-04-23 01:46:11 +02:00
predicate : ( ) = > settings . store . showInvitesPaused ,
replacement : {
2024-06-19 16:45:48 +02:00
match : /\i\.\i\.can\(\i\.\i.MANAGE_GUILD,\i\)/ ,
2024-04-23 01:46:11 +02:00
replace : "true" ,
} ,
2024-05-08 03:50:26 +02:00
} ,
{
2025-01-23 02:22:43 +01:00
find : /,checkElevated:!1}\),\i\.\i\)}(?<=getCurrentUser\(\);return.+?)/ ,
2024-05-08 03:50:26 +02:00
predicate : ( ) = > settings . store . showModView ,
replacement : {
2024-06-19 16:45:48 +02:00
match : /return \i\.\i\(\i\.\i\(\{user:\i,context:\i,checkElevated:!1\}\),\i\.\i\)/ ,
2024-05-08 03:50:26 +02:00
replace : "return true" ,
}
} ,
2024-07-30 23:18:42 +02:00
// 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?
{
2024-11-05 20:49:27 +01:00
find : "#{intl::GUILD_MEMBER_MOD_VIEW_PERMISSION_GRANTED_BY_ARIA_LABEL}" ,
2024-07-30 23:18:42 +02:00
predicate : ( ) = > settings . store . showModView ,
replacement : {
match : /(role:)\i(?=,guildId.{0,100}role:(\i\[))/ ,
replace : "$1$2arguments[0].member.highestRoleId]" ,
}
} ,
2024-11-25 01:30:27 +01:00
// allows you to open mod view on yourself
{
find : ".MEMBER_SAFETY,{modViewPanel:" ,
predicate : ( ) = > settings . store . showModView ,
replacement : {
match : /\i(?=\?null)/ ,
replace : "false"
}
2024-04-23 01:46:11 +02:00
}
2024-12-22 00:55:24 +01:00
]
2023-09-05 19:42:35 +02:00
} ) ;