forked from MapComplete/MastodonBot
Tone down character limit
This commit is contained in:
parent
4d46214109
commit
2407530f86
2 changed files with 6 additions and 2 deletions
|
@ -177,4 +177,8 @@ ${text.split("\n").map(txt => " > " + txt).join("\n")}`)
|
||||||
return mediaAttachment.id
|
return mediaAttachment.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static totalLength(overview: string, rest: string[]) {
|
||||||
|
return overview.length + rest.join("\n").length + 1
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -110,7 +110,7 @@ export class Postbuilder {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
const overview = await this.createOverviewForContributor(uid, changesetsMade)
|
const overview = await this.createOverviewForContributor(uid, changesetsMade)
|
||||||
if (MastodonPoster.length23(overview) + MastodonPoster.length23(toSend.join("\n")) + 1 /*+1 for the separating \n*/ > 500) {
|
if (MastodonPoster.totalLength(overview, toSend) > 500) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
toSend.push(overview)
|
toSend.push(overview)
|
||||||
|
@ -140,7 +140,7 @@ export class Postbuilder {
|
||||||
const themeId = theme.key
|
const themeId = theme.key
|
||||||
const changesetsMade = perTheme.get(themeId)
|
const changesetsMade = perTheme.get(themeId)
|
||||||
const overview = await this.createOverviewForTheme(themeId, changesetsMade)
|
const overview = await this.createOverviewForTheme(themeId, changesetsMade)
|
||||||
if (MastodonPoster.length23(overview) + MastodonPoster.length23(toSend.join("\n")) + 1 > 500) {
|
if (MastodonPoster.totalLength(overview, toSend) > 500) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
toSend.push(overview)
|
toSend.push(overview)
|
||||||
|
|
Loading…
Reference in a new issue