slack-term 1.31.1 → 1.31.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +79 -79
- package/package.json +1 -1
- package/ts/ask.ts +13 -2
package/package.json
CHANGED
package/ts/ask.ts
CHANGED
|
@@ -112,9 +112,15 @@ export const ASK_RESOLVED_PREFIX = `:${ASK_RESOLVED_MARKER}: `;
|
|
|
112
112
|
*
|
|
113
113
|
* Both spellings are accepted on the way in: the shortcode is what Slack
|
|
114
114
|
* stores, and the glyph is what a body hand-edited in the Slack UI can be. */
|
|
115
|
+
/** How a keycap is WRITTEN into the body: the shortcode, because that is the
|
|
116
|
+
* form Slack stores and therefore the form that reads back unchanged. */
|
|
117
|
+
function askPill(i: number): string {
|
|
118
|
+
return `:${ASK_KEYCAPS[i]!.name}:`;
|
|
119
|
+
}
|
|
120
|
+
|
|
115
121
|
function askStripPill(line: string, i: number): string | null {
|
|
116
122
|
const k = ASK_KEYCAPS[i]!;
|
|
117
|
-
for (const pre of [
|
|
123
|
+
for (const pre of [askPill(i), k.glyph]) {
|
|
118
124
|
if (line.startsWith(`${pre} `)) return line.slice(pre.length + 1);
|
|
119
125
|
if (line === pre) return "";
|
|
120
126
|
}
|
|
@@ -142,7 +148,12 @@ export function askBuildText(question: string, body: string, reactable: string[]
|
|
|
142
148
|
lines.push("");
|
|
143
149
|
// Flattened: a choice is a pill label, and a newline in one would split it
|
|
144
150
|
// into a line the parser cannot tell from body text.
|
|
145
|
-
|
|
151
|
+
// Built with the SHORTCODE, matching what Slack stores. Building with the
|
|
152
|
+
// glyph worked only because the parser now accepts both — the body still
|
|
153
|
+
// came back as `:one:` and never matched what was sent. Writing the stored
|
|
154
|
+
// form keeps posted and read-back bytes identical, which is what the
|
|
155
|
+
// round-trip test can actually check. (`poll` already did this.)
|
|
156
|
+
lines.push(...reactable.map((s, i) => `${askPill(i)} ${askFlatten(s)}`));
|
|
146
157
|
if (overflow.length) {
|
|
147
158
|
lines.push("");
|
|
148
159
|
lines.push(...overflow.map((s, i) => `(${i + 11}) ${askFlatten(s)}`));
|