Skip to content

Commit 33fac0c

Browse files
committed
fix gif url favoriting issue (addresses #30)
1 parent e370352 commit 33fac0c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,22 +224,24 @@ async function manageBoard (reaction) {
224224
if (data.content.length > MAXLENGTH - data.contentInfo.length)
225225
data.content = `${data.content.substring(0, MAXLENGTH - data.contentInfo.length)}...`
226226

227+
// set first image
228+
const first_image = (data.imageURLs.length) ? data.imageURLs.shift() : null
227229
// set message embed color
228230
const hexcolor = (settings.hexcolor) ? settings.hexcolor : parseInt(msg.channel.id).toString(16).substring(2, 8)
229231

230232
// attach all embeds
231233
const embeds = [
232234
new EmbedBuilder()
233-
.setURL("https://risu.dev/")
235+
.setURL(first_image)
234236
.setAuthor({ name: msg.author.username, iconURL: data.avatarURL, url: `https://discordapp.com/users/${msg.author.id}`})
235237
.setColor(hexcolor)
236238
.setDescription(data.content + data.contentInfo)
237-
.setImage((data.imageURLs.length) ? data.imageURLs.shift() : null)
239+
.setImage(first_image)
238240
.setTimestamp(new Date())
239241
.setFooter({ text: data.footer, iconURL: null }),
240242
]
241243
data.imageURLs.forEach(url => {
242-
embeds.push(new EmbedBuilder().setURL("https://risu.dev/").setImage(url))
244+
embeds.push(new EmbedBuilder().setURL(first_image).setImage(url))
243245
})
244246

245247
// post embed

0 commit comments

Comments
 (0)