@hardlydifficult/chat 1.0.3 → 1.1.0
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/README.md +6 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -3
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -34,13 +34,13 @@ await channel
|
|
|
34
34
|
Post rich, formatted messages using the `@hardlydifficult/document-generator` package:
|
|
35
35
|
|
|
36
36
|
```typescript
|
|
37
|
-
import {
|
|
37
|
+
import { Document } from '@hardlydifficult/document-generator';
|
|
38
38
|
import { createChatClient } from '@hardlydifficult/chat';
|
|
39
39
|
|
|
40
40
|
const client = createChatClient({ type: 'slack' });
|
|
41
41
|
const channel = await client.connect(channelId);
|
|
42
42
|
|
|
43
|
-
const report =
|
|
43
|
+
const report = new Document()
|
|
44
44
|
.header("Daily Report")
|
|
45
45
|
.text("Here are today's **highlights**:")
|
|
46
46
|
.list(["Feature A completed", "Bug B fixed", "99.9% uptime"])
|
|
@@ -59,7 +59,7 @@ await channel.postMessage(report);
|
|
|
59
59
|
```typescript
|
|
60
60
|
const msg = await channel.postMessage('Initial content');
|
|
61
61
|
await msg.update('Updated content');
|
|
62
|
-
await msg.update(
|
|
62
|
+
await msg.update(new Document().header('New Header').text('New body'));
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
### Delete Messages
|
|
@@ -74,7 +74,7 @@ await msg.delete();
|
|
|
74
74
|
```typescript
|
|
75
75
|
const msg = await channel.postMessage('Main message');
|
|
76
76
|
msg.postReply('This is a thread reply');
|
|
77
|
-
msg.postReply(
|
|
77
|
+
msg.postReply(new Document().text('Rich reply with **formatting**'));
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
### Reactions
|
|
@@ -179,7 +179,7 @@ Disconnect from the platform.
|
|
|
179
179
|
|
|
180
180
|
```typescript
|
|
181
181
|
import { createChatClient } from "@hardlydifficult/chat";
|
|
182
|
-
import {
|
|
182
|
+
import { Document } from "@hardlydifficult/document-generator";
|
|
183
183
|
|
|
184
184
|
const client = createChatClient({ type: "discord" });
|
|
185
185
|
const channel = await client.connect(process.env.CHANNEL_ID);
|
|
@@ -188,7 +188,7 @@ const options = ["Pizza", "Burgers", "Salad"];
|
|
|
188
188
|
const emojis = ["1️⃣", "2️⃣", "3️⃣"];
|
|
189
189
|
const votes: Record<string, string> = {};
|
|
190
190
|
|
|
191
|
-
const pollDoc =
|
|
191
|
+
const pollDoc = new Document()
|
|
192
192
|
.header("🗳️ Lunch Poll")
|
|
193
193
|
.text("What should we order?")
|
|
194
194
|
.list(options.map((o, i) => `${emojis[i]} ${o}`));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { type User, type DiscordConfig, type SlackConfig, type ChatConfig, type Platform, type ReactionEvent, type ReactionCallback, type MessageContent, type PostMessageOptions, Document, doc, } from './types';
|
|
1
|
+
export { type User, type DiscordConfig, type SlackConfig, type ChatConfig, type Platform, type ReactionEvent, type ReactionCallback, type MessageContent, type PostMessageOptions, Document, doc, type DocumentOptions, type DocumentSection, type KeyValueOptions, type TruncatedListOptions, type TimestampOptions, } from './types';
|
|
2
2
|
export { ChatClient } from './ChatClient';
|
|
3
3
|
export { Channel, type ChannelOperations } from './Channel';
|
|
4
4
|
export { Message, ReplyMessage, type MessageOperations } from './Message';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,IAAI,EACT,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,IAAI,EACT,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EAEvB,QAAQ,EACR,GAAG,EACH,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,GACtB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAS/D"}
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SlackChatClient = exports.DiscordChatClient = exports.ReplyMessage = exports.Message = exports.Channel = exports.ChatClient = exports.doc = exports.Document = void 0;
|
|
4
4
|
exports.createChatClient = createChatClient;
|
|
5
|
-
// Types
|
|
5
|
+
// Types
|
|
6
6
|
var types_1 = require("./types");
|
|
7
|
+
// Document and related types (from document-generator)
|
|
7
8
|
Object.defineProperty(exports, "Document", { enumerable: true, get: function () { return types_1.Document; } });
|
|
8
9
|
Object.defineProperty(exports, "doc", { enumerable: true, get: function () { return types_1.doc; } });
|
|
9
10
|
// Core classes
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAwDA,4CASC;AAjED,QAAQ;AACR,iCAkBiB;AARf,uDAAuD;AACvD,iGAAA,QAAQ,OAAA;AACR,4FAAA,GAAG,OAAA;AAQL,eAAe;AACf,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,qCAA4D;AAAnD,kGAAA,OAAO,OAAA;AAChB,qCAA0E;AAAjE,kGAAA,OAAO,OAAA;AAAE,uGAAA,YAAY,OAAA;AAE9B,2BAA2B;AAC3B,yCAAoD;AAA3C,0GAAA,iBAAiB,OAAA;AAC1B,uCAAgD;AAAvC,wGAAA,eAAe,OAAA;AAKxB,2CAAoD;AACpD,yCAAgD;AAEhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,gBAAgB,CAAC,MAAkB;IACjD,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,SAAS;YACZ,OAAO,IAAI,yBAAiB,CAAC,MAAM,CAAC,CAAC;QACvC,KAAK,OAAO;YACV,OAAO,IAAI,uBAAe,CAAC,MAAM,CAAC,CAAC;QACrC;YACE,MAAM,IAAI,KAAK,CAAC,0BAA2B,MAA2B,CAAC,IAAI,EAAE,CAAC,CAAC;IACnF,CAAC;AACH,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Document } from '@hardlydifficult/document-generator';
|
|
2
|
-
export { doc,
|
|
2
|
+
export { Document, doc, type DocumentOptions, type DocumentSection, type KeyValueOptions, type TruncatedListOptions, type TimestampOptions, } from '@hardlydifficult/document-generator';
|
|
3
3
|
/**
|
|
4
4
|
* Configuration for Discord client
|
|
5
5
|
*/
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAG/D,OAAO,EACL,QAAQ,EACR,GAAG,EACH,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,GACtB,MAAM,qCAAqC,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,WAAW,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,IAAI,EAAE,IAAI,CAAC;IACX,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
package/dist/types.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
// Re-export
|
|
3
|
+
exports.doc = exports.Document = void 0;
|
|
4
|
+
// Re-export Document and related types from document-generator
|
|
5
5
|
var document_generator_1 = require("@hardlydifficult/document-generator");
|
|
6
|
-
Object.defineProperty(exports, "doc", { enumerable: true, get: function () { return document_generator_1.doc; } });
|
|
7
6
|
Object.defineProperty(exports, "Document", { enumerable: true, get: function () { return document_generator_1.Document; } });
|
|
7
|
+
Object.defineProperty(exports, "doc", { enumerable: true, get: function () { return document_generator_1.doc; } });
|
|
8
8
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAEA,+DAA+D;AAC/D,0EAQ6C;AAP3C,8GAAA,QAAQ,OAAA;AACR,yGAAA,GAAG,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hardlydifficult/chat",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"vitest": "1.6.1"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@hardlydifficult/document-generator": ">=1.
|
|
28
|
+
"@hardlydifficult/document-generator": ">=1.1.0"
|
|
29
29
|
}
|
|
30
30
|
}
|