Better emoji pack names
This commit is contained in:
@@ -229,14 +229,16 @@ async function syncSpaceExpressions(data, checkBeforeSync) {
|
||||
*/
|
||||
async function update(spaceID, key, eventKey, fn) {
|
||||
if (!(key in data) || !data[key].length) return
|
||||
const content = await fn(data[key])
|
||||
const guild = discord.guilds.get(data.guild_id)
|
||||
assert(guild)
|
||||
const content = await fn(data[key], guild)
|
||||
if (checkBeforeSync) {
|
||||
let existing
|
||||
try {
|
||||
existing = await api.getStateEvent(spaceID, "im.ponies.room_emotes", eventKey)
|
||||
} catch (e) {
|
||||
// State event not found. This space doesn't have any existing emojis. We create a dummy empty event for comparison's sake.
|
||||
existing = fn([])
|
||||
existing = fn([], guild)
|
||||
}
|
||||
if (isDeepStrictEqual(existing, content)) return
|
||||
}
|
||||
|
||||
@@ -9,11 +9,12 @@ const file = sync.require("../../matrix/file")
|
||||
|
||||
/**
|
||||
* @param {DiscordTypes.APIEmoji[]} emojis
|
||||
* @param {DiscordTypes.APIGuild} guild
|
||||
*/
|
||||
async function emojisToState(emojis) {
|
||||
async function emojisToState(emojis, guild) {
|
||||
const result = {
|
||||
pack: {
|
||||
display_name: "Discord Emojis",
|
||||
display_name: `${guild.name} (Discord Emojis)`,
|
||||
usage: ["emoticon"] // we'll see...
|
||||
},
|
||||
images: {
|
||||
@@ -42,11 +43,12 @@ async function emojisToState(emojis) {
|
||||
|
||||
/**
|
||||
* @param {DiscordTypes.APISticker[]} stickers
|
||||
* @param {DiscordTypes.APIGuild} guild
|
||||
*/
|
||||
async function stickersToState(stickers) {
|
||||
async function stickersToState(stickers, guild) {
|
||||
const result = {
|
||||
pack: {
|
||||
display_name: "Discord Stickers",
|
||||
display_name: `${guild.name} (Discord Stickers)`,
|
||||
usage: ["sticker"] // we'll see...
|
||||
},
|
||||
images: {
|
||||
|
||||
Reference in New Issue
Block a user