fix Expression Cloner, ServerInfo & SeeSummaries plugins (#3536)
This commit is contained in:
parent
4b0ff3ee5f
commit
c653e36137
5 changed files with 33 additions and 12 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue