Improve emoji uploading experience
This commit is contained in:
@@ -531,6 +531,16 @@ async function messageToEvent(message, guild, options = {}, di) {
|
|||||||
message.content = "changed the channel name to **" + message.content + "**"
|
message.content = "changed the channel name to **" + message.content + "**"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle message type 63, new emoji announcement
|
||||||
|
// @ts-expect-error - should be changed to a DiscordTypes reference once it has been documented
|
||||||
|
if (message.type === 63) {
|
||||||
|
const match = message.content.match(/^<(a?):([^:>]{1,64}):([0-9]+)>$/)
|
||||||
|
assert(match, `message type 63, which announces a new emoji, did not include an emoji. the actual content was: "${message.content}"`)
|
||||||
|
const name = match[2]
|
||||||
|
msgtype = "m.emote"
|
||||||
|
message.content = `added a new emoji, ${message.content} :${name}:`
|
||||||
|
}
|
||||||
|
|
||||||
// Forwarded content appears first
|
// Forwarded content appears first
|
||||||
if (message.message_reference?.type === DiscordTypes.MessageReferenceType.Forward && message.message_snapshots?.length) {
|
if (message.message_reference?.type === DiscordTypes.MessageReferenceType.Forward && message.message_snapshots?.length) {
|
||||||
// Forwarded notice
|
// Forwarded notice
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ const commands = [{
|
|||||||
.addLine(`Ⓜ️ *If you were a Discord user, you wouldn't have permission to create emojis. ${matrixOnlyConclusion}`, `Ⓜ️ <em>If you were a Discord user, you wouldn't have permission to create emojis. ${matrixOnlyConclusion}</em>`, matrixOnlyReason === "CAPACITY")
|
.addLine(`Ⓜ️ *If you were a Discord user, you wouldn't have permission to create emojis. ${matrixOnlyConclusion}`, `Ⓜ️ <em>If you were a Discord user, you wouldn't have permission to create emojis. ${matrixOnlyConclusion}</em>`, matrixOnlyReason === "CAPACITY")
|
||||||
.addLine("[Preview not available in plain text.]", "Preview:")
|
.addLine("[Preview not available in plain text.]", "Preview:")
|
||||||
for (const e of toUpload) {
|
for (const e of toUpload) {
|
||||||
b.add("", `<img data-mx-emoticon height="48" src="${e.url}" title=":${e.name}:" alt=":${e.name}:">`)
|
b.add("", `:${e.name}: <img data-mx-emoticon height="48" src="${e.url}" title=":${e.name}:" alt=":${e.name}:">`)
|
||||||
}
|
}
|
||||||
b.addLine("Hit ✅ to add it.")
|
b.addLine("Hit ✅ to add it.")
|
||||||
const sent = await api.sendEvent(event.room_id, "m.room.message", {
|
const sent = await api.sendEvent(event.room_id, "m.room.message", {
|
||||||
|
|||||||
Reference in New Issue
Block a user