mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-08 22:23:02 -04:00
Banners Everywhere Nameplate Setting
This commit is contained in:
parent
ad4ab4c1e5
commit
4d20ef0d64
1 changed files with 33 additions and 9 deletions
|
@ -19,12 +19,27 @@ interface iUSRBG extends Plugin {
|
||||||
getImageUrl(userId: string): string | null;
|
getImageUrl(userId: string): string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Nameplate {
|
||||||
|
imgAlt: string;
|
||||||
|
palette: {
|
||||||
|
darkBackground: string;
|
||||||
|
lightBackground: string;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
src: string;
|
||||||
|
}
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
animate: {
|
animate: {
|
||||||
description: "Animate banners",
|
description: "Animate banners",
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
preferNameplate: {
|
||||||
|
description: "prefer nameplate over banner",
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const DATASTORE_KEY = "bannersEverywhere";
|
const DATASTORE_KEY = "bannersEverywhere";
|
||||||
|
@ -40,17 +55,21 @@ export default definePlugin({
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "#{intl::GUILD_OWNER}),",
|
find: "#{intl::GUILD_OWNER}),",
|
||||||
replacement:
|
replacement: [
|
||||||
{
|
{
|
||||||
// We add the banner as a property while we can still access the user id
|
// We add the banner as a property while we can still access the user id
|
||||||
match: /verified:(\i).isVerifiedBot.*?name:null.*?(?=avatar:)/,
|
match: /(?<=nameplate:(\i).*?)verified:(\i).isVerifiedBot.*?name:null.*?(?=avatar:)/,
|
||||||
replace: "$&banner:$self.memberListBannerHook($1),",
|
replace: "$&banner:$self.memberListBannerHook($2, $1),",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
match: /(?<=\),nameplate:)(\i)/,
|
||||||
|
replace: "$self.nameplate($1)"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "role:\"listitem\",innerRef",
|
find: "role:\"listitem\",innerRef",
|
||||||
replacement:
|
replacement: {
|
||||||
{
|
|
||||||
// We cant access the user id here, so we take the banner property we set earlier
|
// We cant access the user id here, so we take the banner property we set earlier
|
||||||
match: /focusProps.\i\}=(\i).*?children:\[/,
|
match: /focusProps.\i\}=(\i).*?children:\[/,
|
||||||
replace: "$&$1.banner,"
|
replace: "$&$1.banner,"
|
||||||
|
@ -70,9 +89,14 @@ export default definePlugin({
|
||||||
DataStore.set(DATASTORE_KEY, this.data);
|
DataStore.set(DATASTORE_KEY, this.data);
|
||||||
},
|
},
|
||||||
|
|
||||||
memberListBannerHook(user: User) {
|
nameplate(nameplate: Nameplate | undefined) {
|
||||||
|
if (settings.store.preferNameplate) return nameplate;
|
||||||
|
},
|
||||||
|
|
||||||
|
memberListBannerHook(user: User, nameplate: Nameplate | undefined) {
|
||||||
let url = this.getBanner(user.id);
|
let url = this.getBanner(user.id);
|
||||||
if (!url) return;
|
if (!url) return;
|
||||||
|
if (settings.store.preferNameplate && nameplate) return;
|
||||||
if (!settings.store.animate) {
|
if (!settings.store.animate) {
|
||||||
// Discord Banners
|
// Discord Banners
|
||||||
url = url.replace(".gif", ".png");
|
url = url.replace(".gif", ".png");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue