increase answer length

This commit is contained in:
derpystuff 2023-01-11 22:32:59 +01:00
parent c1c63e3fc2
commit 94bee05892

View file

@ -4,7 +4,7 @@ const { editOrReply } = require('../../../labscore/utils/message')
const { STATICS } = require('../../../labscore/utils/statics') const { STATICS } = require('../../../labscore/utils/statics')
const { paginator } = require('../../../labscore/client'); const { paginator } = require('../../../labscore/client');
const { bing, quora } = require('../../../labscore/api'); const { quora } = require('../../../labscore/api');
function createQuoraAnswerPage(context, question, answer){ function createQuoraAnswerPage(context, question, answer){
let tags = question.tags.map((t) => { let tags = question.tags.map((t) => {
@ -15,7 +15,7 @@ function createQuoraAnswerPage(context, question, answer){
createEmbed("default", context, { createEmbed("default", context, {
title: question.title, title: question.title,
url: answer.url, url: answer.url,
description: `${tags.splice(0, 4).join(' ')}\n\n${answer.content.substr(0,1000)}`, description: `${tags.splice(0, 4).join(' ')}\n\n${answer.content.substr(0,2000)}`,
footer: { footer: {
iconUrl: STATICS.quora, iconUrl: STATICS.quora,
text: `Quora • ${context.application.name}` text: `Quora • ${context.application.name}`
@ -23,6 +23,12 @@ function createQuoraAnswerPage(context, question, answer){
}) })
] ]
} }
if(answer.content.length >= 2000){
if(res.embeds[0].description.endsWith(' ')) res.embeds[0].description = res.embeds[0].description.substr(0,res.embeds[0].description.length - 1)
res.embeds[0].description += link(answer.url, '...', 'Click to read the entire answer.')
}
if(answer.author){ if(answer.author){
res.embeds[0].author = { res.embeds[0].author = {
name: answer.author.name.substr(0,1000), name: answer.author.name.substr(0,1000),