Skip to content

Commit

Permalink
horoscope only slice off extra sentences when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
Supinic committed Oct 6, 2024
1 parent 14f02be commit dd4daf2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion commands/horoscope/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@ module.exports = {
// "Heuristic" that removes the last two sentences from the horoscope. This is aimed to slim down
// the response, since it's usually a bit too long (around 600 characters) for Twitch (500 chars);
const fullTextArray = node.text().trim().split(/\.\s/);
const trimmedText = fullTextArray.slice(0, -2).join(". ");
const trimmedArray = (fullTextArray.length > 3)
? fullTextArray.slice(0, -2)
: fullTextArray;

const trimmedText = trimmedArray.join(". ");
const prefix = (own) ? "Your" : "";
return {
reply: `${prefix} ${sb.Utils.capitalize(zodiacName)} horoscope for today: ${trimmedText}.`
Expand Down

0 comments on commit dd4daf2

Please sign in to comment.