fix Expression Cloner, ServerInfo & SeeSummaries plugins (#3536)

This commit is contained in:
sadan4 2025-07-03 20:14:59 -04:00 committed by GitHub
parent 4b0ff3ee5f
commit c653e36137
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 33 additions and 12 deletions

View file

@ -19,6 +19,7 @@
import { MessageObject } from "@api/MessageEvents";
import { ChannelActionCreators, ChannelStore, ComponentDispatch, Constants, FluxDispatcher, GuildStore, i18n, IconUtils, InviteActions, MessageActions, RestAPI, SelectedChannelStore, SelectedGuildStore, UserProfileActions, UserProfileStore, UserSettingsActionCreators, UserUtils } from "@webpack/common";
import { Channel, Guild, Message, User } from "discord-types/general";
import GuildFeatures from "discord-types/other/Constants";
import { Except } from "type-fest";
import { runtimeHashMessageKey } from "./intlHash";
@ -218,3 +219,15 @@ export function getEmojiURL(id: string, animated: boolean, size: number) {
const url = IconUtils.getEmojiURL({ id, animated, size });
return animated ? url.replace(".webp", ".gif") : url;
}
// Discord has a similar function in their code
export function getGuildAcronym(guild: Guild): string {
return guild.name
.replaceAll("'s ", " ")
.replace(/\w+/g, m => m[0])
.replace(/\s/g, "");
}
export function hasGuildFeature(guild: Guild, feature: keyof GuildFeatures["GuildFeatures"]): boolean {
return guild.features?.has(feature) ?? false;
}