Fix all plugins for new i18n lib (#2993)

This commit is contained in:
Nuckyz 2024-11-05 16:49:27 -03:00
parent 5216bcca1e
commit 00f82e96bd
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
89 changed files with 351 additions and 238 deletions

View file

@ -18,8 +18,9 @@
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord";
import definePlugin from "@utils/types";
import { Constants, GuildStore, i18n, RestAPI } from "@webpack/common";
import { Constants, GuildStore, RestAPI } from "@webpack/common";
function showDisableInvites(guildId: string) {
// @ts-ignore
@ -43,15 +44,15 @@ export default definePlugin({
patches: [
{
find: "Messages.GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION",
find: "#{intl::GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION}",
group: true,
replacement: [
{
match: /children:\i\.\i\.\i\.GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION/,
match: /children:\i\.\i\.string\(\i\.\i#{intl::GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION}\)/,
replace: "children: $self.renderInvitesLabel({guildId:arguments[0].guildId,setChecked})",
},
{
match: /\.INVITES_DISABLED\)(?=.+?\.Messages\.INVITES_PERMANENTLY_DISABLED_TIP.+?checked:(\i)).+?\[\1,(\i)\]=\i.useState\(\i\)/,
match: /\.INVITES_DISABLED\)(?=.+?#{intl::INVITES_PERMANENTLY_DISABLED_TIP}.+?checked:(\i)).+?\[\1,(\i)\]=\i.useState\(\i\)/,
replace: "$&,setChecked=$2"
}
]
@ -61,7 +62,7 @@ export default definePlugin({
renderInvitesLabel: ErrorBoundary.wrap(({ guildId, setChecked }) => {
return (
<div>
{i18n.Messages.GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION}
{getIntlMessage("GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION")}
{showDisableInvites(guildId) && <a role="button" onClick={() => {
setChecked(true);
disableInvites(guildId);