Skip to content

Commit 04db07d

Browse files
authored
Merge branch 'master' into title-from-other-channel
2 parents 9691517 + c4d3f73 commit 04db07d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/modules/playground.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ function createPlaygroundEmbed(
124124
) {
125125
const embed = new MessageEmbed()
126126
.setColor(TS_BLUE)
127-
.setTitle('Shortened Playground Link')
127+
.setTitle('Playground Link')
128128
.setAuthor(author.tag, author.displayAvatarURL())
129129
.setURL(url);
130130

@@ -174,14 +174,18 @@ function createPlaygroundEmbed(
174174
}
175175
const prettyEndChar = pretty.length - (normalized.length - endChar);
176176
const formattedSection = pretty.slice(startChar, prettyEndChar);
177+
const content =
178+
(startChar === 0 ? '' : '...\n') +
179+
formattedSection.replace(/^\s*\n|\n\s*$/g, '') +
180+
(prettyEndChar === pretty.length ? '' : '\n...');
177181

178182
if (!startLine && !endLine) {
179183
embed.setFooter(
180184
'You can choose specific lines to embed by selecting them before copying the link.',
181185
);
182186
}
183187

184-
return embed.setDescription(makeCodeBlock(formattedSection));
188+
return embed.setDescription('**Preview:**' + makeCodeBlock(content));
185189
}
186190

187191
async function shortenPlaygroundLink(url: string) {

0 commit comments

Comments
 (0)