2025-08-13 01:27:49 +07:00
|
|
|
import { lookupModule, lookupModules } from '@revenge-mod/modules/finders'
|
2025-05-05 19:13:07 +07:00
|
|
|
import {
|
feat!: module finders refactor (#6)
- Renamed `byX` filters to `withX`.
It is more correct. For example: You don't lookup, wait for, or get modules **BY** props. You lookup, wait for, and get modules **WITH** props.
- Renamed `*byImportedPath` to `*withImportedPath`
For consistency with the above change.
- Renamed `getModule` to `getModules`.
The API allows getting multiple modules and not just a single one. Types are renamed as well.
`getModuleByImportedPath` remains the same as it only gets one single module with a unique imported path.
- `withX` filter **helpers** removed.
They can now be replaced with the new capability-based `and` filter.
- `preferExports` and `moduleStateAware` filters removed.
They can now be replaced with the new capability-based `and` filter.
- Composite finders renamed.
`some` -> `or`, `every` -> `and`
- Composite finders takes a capability-based approach.
- Filter generators now need to attach runtime flag to let the system know whether the generated filter can be used to filter modules without proper exports or not.
## Misc.
- Removed useless unsub call in Profile Badges
- Use `queueMicrotask` with `asap`
# Features
## Capability-based approach to composite filters
```js
// Old
byProps(...).withDependencies(...)
// Old, same as: preferExports(byProps(...), byDependencies(...))
every(byDependencies(...), byProps(...))
// Old, ordering matters, this would fail unexpectedly!
every(byProps(...), byDependencies(...))
// New
withProps(...).and(withDependencies(...))
// New (as well), ordering doesn't matter, this has the same result as above
withDependencies(...).and(withProps(...))
```
2025-08-30 09:19:57 +07:00
|
|
|
withDependencies,
|
2025-05-05 19:13:07 +07:00
|
|
|
withoutProps,
|
feat!: module finders refactor (#6)
- Renamed `byX` filters to `withX`.
It is more correct. For example: You don't lookup, wait for, or get modules **BY** props. You lookup, wait for, and get modules **WITH** props.
- Renamed `*byImportedPath` to `*withImportedPath`
For consistency with the above change.
- Renamed `getModule` to `getModules`.
The API allows getting multiple modules and not just a single one. Types are renamed as well.
`getModuleByImportedPath` remains the same as it only gets one single module with a unique imported path.
- `withX` filter **helpers** removed.
They can now be replaced with the new capability-based `and` filter.
- `preferExports` and `moduleStateAware` filters removed.
They can now be replaced with the new capability-based `and` filter.
- Composite finders renamed.
`some` -> `or`, `every` -> `and`
- Composite finders takes a capability-based approach.
- Filter generators now need to attach runtime flag to let the system know whether the generated filter can be used to filter modules without proper exports or not.
## Misc.
- Removed useless unsub call in Profile Badges
- Use `queueMicrotask` with `asap`
# Features
## Capability-based approach to composite filters
```js
// Old
byProps(...).withDependencies(...)
// Old, same as: preferExports(byProps(...), byDependencies(...))
every(byDependencies(...), byProps(...))
// Old, ordering matters, this would fail unexpectedly!
every(byProps(...), byDependencies(...))
// New
withProps(...).and(withDependencies(...))
// New (as well), ordering doesn't matter, this has the same result as above
withDependencies(...).and(withProps(...))
```
2025-08-30 09:19:57 +07:00
|
|
|
withProps,
|
2025-05-05 19:13:07 +07:00
|
|
|
} from '@revenge-mod/modules/finders/filters'
|
2025-06-11 23:19:25 +07:00
|
|
|
import {
|
2025-07-10 21:23:39 +07:00
|
|
|
ReactJSXRuntimeModuleId,
|
2025-06-11 23:19:25 +07:00
|
|
|
ReactModuleId,
|
|
|
|
|
ReactNativeModuleId,
|
|
|
|
|
} from '@revenge-mod/react'
|
2025-05-04 20:27:07 +07:00
|
|
|
import { proxify } from '@revenge-mod/utils/proxy'
|
2025-05-08 18:52:57 +07:00
|
|
|
import { DispatcherModuleId } from './common/flux'
|
2026-07-31 13:15:01 +07:00
|
|
|
import { ImportTrackerModuleId } from './common/import-tracker'
|
2025-05-09 21:52:36 +07:00
|
|
|
import type { DiscordModules } from './types'
|
2025-05-04 20:27:07 +07:00
|
|
|
|
2026-04-28 10:15:54 +07:00
|
|
|
const { relative, loose } = withDependencies
|
2025-06-13 23:35:23 +07:00
|
|
|
|
2025-07-04 22:23:56 +07:00
|
|
|
// modules/action_sheet/native/ActionSheetActionCreators.tsx
|
2025-06-03 16:24:58 +07:00
|
|
|
export let ActionSheetActionCreators: DiscordModules.Actions.ActionSheetActionCreators =
|
|
|
|
|
proxify(
|
|
|
|
|
() => {
|
|
|
|
|
const [module] = lookupModule(
|
feat!: module finders refactor (#6)
- Renamed `byX` filters to `withX`.
It is more correct. For example: You don't lookup, wait for, or get modules **BY** props. You lookup, wait for, and get modules **WITH** props.
- Renamed `*byImportedPath` to `*withImportedPath`
For consistency with the above change.
- Renamed `getModule` to `getModules`.
The API allows getting multiple modules and not just a single one. Types are renamed as well.
`getModuleByImportedPath` remains the same as it only gets one single module with a unique imported path.
- `withX` filter **helpers** removed.
They can now be replaced with the new capability-based `and` filter.
- `preferExports` and `moduleStateAware` filters removed.
They can now be replaced with the new capability-based `and` filter.
- Composite finders renamed.
`some` -> `or`, `every` -> `and`
- Composite finders takes a capability-based approach.
- Filter generators now need to attach runtime flag to let the system know whether the generated filter can be used to filter modules without proper exports or not.
## Misc.
- Removed useless unsub call in Profile Badges
- Use `queueMicrotask` with `asap`
# Features
## Capability-based approach to composite filters
```js
// Old
byProps(...).withDependencies(...)
// Old, same as: preferExports(byProps(...), byDependencies(...))
every(byDependencies(...), byProps(...))
// Old, ordering matters, this would fail unexpectedly!
every(byProps(...), byDependencies(...))
// New
withProps(...).and(withDependencies(...))
// New (as well), ordering doesn't matter, this has the same result as above
withDependencies(...).and(withProps(...))
```
2025-08-30 09:19:57 +07:00
|
|
|
withProps<DiscordModules.Actions.ActionSheetActionCreators>(
|
|
|
|
|
'hideActionSheet',
|
|
|
|
|
'openLazy',
|
|
|
|
|
).and(
|
2026-04-28 10:15:54 +07:00
|
|
|
withDependencies(
|
|
|
|
|
loose([
|
|
|
|
|
null,
|
|
|
|
|
ReactModuleId,
|
|
|
|
|
ReactJSXRuntimeModuleId,
|
|
|
|
|
DispatcherModuleId,
|
|
|
|
|
relative(1),
|
|
|
|
|
relative(2),
|
|
|
|
|
]),
|
|
|
|
|
),
|
2025-06-03 16:24:58 +07:00
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if (module) return (ActionSheetActionCreators = module)
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-07-13 19:18:41 +07:00
|
|
|
hint: {},
|
2025-06-03 16:24:58 +07:00
|
|
|
},
|
|
|
|
|
)!
|
|
|
|
|
|
2025-07-04 22:23:56 +07:00
|
|
|
// actions/native/AlertActionCreators.tsx
|
2025-06-03 16:24:58 +07:00
|
|
|
export let AlertActionCreators: DiscordModules.Actions.AlertActionCreators =
|
|
|
|
|
proxify(
|
|
|
|
|
() => {
|
|
|
|
|
const [module] = lookupModule(
|
feat!: module finders refactor (#6)
- Renamed `byX` filters to `withX`.
It is more correct. For example: You don't lookup, wait for, or get modules **BY** props. You lookup, wait for, and get modules **WITH** props.
- Renamed `*byImportedPath` to `*withImportedPath`
For consistency with the above change.
- Renamed `getModule` to `getModules`.
The API allows getting multiple modules and not just a single one. Types are renamed as well.
`getModuleByImportedPath` remains the same as it only gets one single module with a unique imported path.
- `withX` filter **helpers** removed.
They can now be replaced with the new capability-based `and` filter.
- `preferExports` and `moduleStateAware` filters removed.
They can now be replaced with the new capability-based `and` filter.
- Composite finders renamed.
`some` -> `or`, `every` -> `and`
- Composite finders takes a capability-based approach.
- Filter generators now need to attach runtime flag to let the system know whether the generated filter can be used to filter modules without proper exports or not.
## Misc.
- Removed useless unsub call in Profile Badges
- Use `queueMicrotask` with `asap`
# Features
## Capability-based approach to composite filters
```js
// Old
byProps(...).withDependencies(...)
// Old, same as: preferExports(byProps(...), byDependencies(...))
every(byDependencies(...), byProps(...))
// Old, ordering matters, this would fail unexpectedly!
every(byProps(...), byDependencies(...))
// New
withProps(...).and(withDependencies(...))
// New (as well), ordering doesn't matter, this has the same result as above
withDependencies(...).and(withProps(...))
```
2025-08-30 09:19:57 +07:00
|
|
|
withProps<DiscordModules.Actions.AlertActionCreators>(
|
|
|
|
|
'openAlert',
|
|
|
|
|
).and(
|
|
|
|
|
withDependencies([
|
2026-05-13 01:03:28 +07:00
|
|
|
null,
|
2026-06-13 01:00:19 +07:00
|
|
|
null,
|
2026-01-17 20:54:14 +07:00
|
|
|
[ReactNativeModuleId, ImportTrackerModuleId],
|
2026-06-13 01:00:19 +07:00
|
|
|
relative(1),
|
|
|
|
|
relative(2),
|
2026-01-17 20:54:14 +07:00
|
|
|
ImportTrackerModuleId,
|
2025-11-01 20:09:15 +07:00
|
|
|
]),
|
2025-06-03 16:24:58 +07:00
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if (module) return (AlertActionCreators = module)
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-07-13 19:18:41 +07:00
|
|
|
hint: {},
|
2025-06-03 16:24:58 +07:00
|
|
|
},
|
|
|
|
|
)!
|
|
|
|
|
|
2025-07-04 22:23:56 +07:00
|
|
|
// modules/toast/native/ToastActionCreators.tsx
|
2025-06-03 16:24:58 +07:00
|
|
|
export let ToastActionCreators: DiscordModules.Actions.ToastActionCreators =
|
|
|
|
|
proxify(() => {
|
|
|
|
|
// [Dispatcher, ImportTracker]
|
2025-10-12 01:27:53 +07:00
|
|
|
// Many other modules share the same dependencies, the second yielded should be the correct module.
|
2025-06-03 16:24:58 +07:00
|
|
|
|
|
|
|
|
const generator = lookupModules(
|
feat!: module finders refactor (#6)
- Renamed `byX` filters to `withX`.
It is more correct. For example: You don't lookup, wait for, or get modules **BY** props. You lookup, wait for, and get modules **WITH** props.
- Renamed `*byImportedPath` to `*withImportedPath`
For consistency with the above change.
- Renamed `getModule` to `getModules`.
The API allows getting multiple modules and not just a single one. Types are renamed as well.
`getModuleByImportedPath` remains the same as it only gets one single module with a unique imported path.
- `withX` filter **helpers** removed.
They can now be replaced with the new capability-based `and` filter.
- `preferExports` and `moduleStateAware` filters removed.
They can now be replaced with the new capability-based `and` filter.
- Composite finders renamed.
`some` -> `or`, `every` -> `and`
- Composite finders takes a capability-based approach.
- Filter generators now need to attach runtime flag to let the system know whether the generated filter can be used to filter modules without proper exports or not.
## Misc.
- Removed useless unsub call in Profile Badges
- Use `queueMicrotask` with `asap`
# Features
## Capability-based approach to composite filters
```js
// Old
byProps(...).withDependencies(...)
// Old, same as: preferExports(byProps(...), byDependencies(...))
every(byDependencies(...), byProps(...))
// Old, ordering matters, this would fail unexpectedly!
every(byProps(...), byDependencies(...))
// New
withProps(...).and(withDependencies(...))
// New (as well), ordering doesn't matter, this has the same result as above
withDependencies(...).and(withProps(...))
```
2025-08-30 09:19:57 +07:00
|
|
|
withProps<DiscordModules.Actions.ToastActionCreators>('open')
|
|
|
|
|
.and(withoutProps('init'))
|
2026-01-17 20:54:14 +07:00
|
|
|
.and(
|
|
|
|
|
withDependencies([
|
|
|
|
|
DispatcherModuleId,
|
|
|
|
|
ImportTrackerModuleId,
|
|
|
|
|
]),
|
|
|
|
|
),
|
2025-05-08 18:52:57 +07:00
|
|
|
)
|
|
|
|
|
|
2025-06-03 16:24:58 +07:00
|
|
|
for (const [module] of generator)
|
|
|
|
|
if (module.open.length === 1) return (ToastActionCreators = module)
|
|
|
|
|
})!
|