File tree 5 files changed +10
-50
lines changed
5 files changed +10
-50
lines changed Original file line number Diff line number Diff line change 1
- import { ContentTypeText } from "@xmtp/content-type-text" ;
2
1
import { Client , type XmtpEnv } from "@xmtp/node-sdk" ;
3
2
import { Alchemy , Network } from "alchemy-sdk" ;
4
3
import { createSigner , getEncryptionKeyFromHex } from "@/helpers" ;
@@ -41,16 +40,9 @@ async function main() {
41
40
42
41
for await ( const message of await stream ) {
43
42
if (
44
- ! message ||
45
- ! message . contentType ||
46
- ! ContentTypeText . sameAs ( message . contentType )
43
+ message ?. senderInboxId . toLowerCase ( ) === client . inboxId . toLowerCase ( ) ||
44
+ message ?. contentType ?. typeId !== "text"
47
45
) {
48
- console . log ( "Invalid message, skipping" , message ?. contentType ?. typeId ) ;
49
- continue ;
50
- }
51
-
52
- // Ignore own messages
53
- if ( message . senderInboxId === client . inboxId ) {
54
46
continue ;
55
47
}
56
48
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ This agent replies `gm`
9
9
## Basic usage
10
10
11
11
``` tsx
12
- import { ContentTypeText } from " @xmtp/content-type-text" ;
13
12
import { Client , type XmtpEnv } from " @xmtp/node-sdk" ;
14
13
import { createSigner , getEncryptionKeyFromHex } from " @/helpers" ;
15
14
@@ -44,16 +43,9 @@ async function main() {
44
43
45
44
for await (const message of await stream ) {
46
45
if (
47
- ! message ||
48
- ! message .contentType ||
49
- ! ContentTypeText .sameAs (message .contentType )
46
+ message ?.senderInboxId .toLowerCase () === client .inboxId .toLowerCase () ||
47
+ message ?.contentType ?.typeId !== " text"
50
48
) {
51
- console .log (" Invalid message, skipping" , message );
52
- continue ;
53
- }
54
-
55
- // Ignore own messages
56
- if (message .senderInboxId === client .inboxId ) {
57
49
continue ;
58
50
}
59
51
Original file line number Diff line number Diff line change 1
- import { ContentTypeText } from "@xmtp/content-type-text" ;
2
1
import { Client , type XmtpEnv } from "@xmtp/node-sdk" ;
3
2
import { createSigner , getEncryptionKeyFromHex } from "@/helpers" ;
4
3
@@ -33,16 +32,9 @@ async function main() {
33
32
34
33
for await ( const message of await stream ) {
35
34
if (
36
- ! message ||
37
- ! message . contentType ||
38
- ! ContentTypeText . sameAs ( message . contentType )
35
+ message ?. senderInboxId . toLowerCase ( ) === client . inboxId . toLowerCase ( ) ||
36
+ message ?. contentType ?. typeId !== "text"
39
37
) {
40
- console . log ( "Invalid message, skipping" , message ) ;
41
- continue ;
42
- }
43
-
44
- // Ignore own messages
45
- if ( message . senderInboxId === client . inboxId ) {
46
38
continue ;
47
39
}
48
40
Original file line number Diff line number Diff line change @@ -24,7 +24,6 @@ yarn gen:keys
24
24
## Usage
25
25
26
26
``` tsx
27
- import { ContentTypeText } from " @xmtp/content-type-text" ;
28
27
import { Client , type XmtpEnv } from " @xmtp/node-sdk" ;
29
28
import OpenAI from " openai" ;
30
29
import { createSigner , getEncryptionKeyFromHex } from " @/helpers" ;
@@ -67,16 +66,9 @@ async function main() {
67
66
68
67
for await (const message of await stream ) {
69
68
if (
70
- ! message ||
71
- ! message .contentType ||
72
- ! ContentTypeText .sameAs (message .contentType )
69
+ message ?.senderInboxId .toLowerCase () === client .inboxId .toLowerCase () ||
70
+ message ?.contentType ?.typeId !== " text"
73
71
) {
74
- console .log (" Invalid message, skipping" , message );
75
- continue ;
76
- }
77
-
78
- // Ignore own messages
79
- if (message .senderInboxId === client .inboxId ) {
80
72
continue ;
81
73
}
82
74
Original file line number Diff line number Diff line change 1
- import { ContentTypeText } from "@xmtp/content-type-text" ;
2
1
import { Client , type XmtpEnv } from "@xmtp/node-sdk" ;
3
2
import OpenAI from "openai" ;
4
3
import { createSigner , getEncryptionKeyFromHex } from "@/helpers" ;
@@ -41,16 +40,9 @@ async function main() {
41
40
42
41
for await ( const message of await stream ) {
43
42
if (
44
- ! message ||
45
- ! message . contentType ||
46
- ! ContentTypeText . sameAs ( message . contentType )
43
+ message ?. senderInboxId . toLowerCase ( ) === client . inboxId . toLowerCase ( ) ||
44
+ message ?. contentType ?. typeId !== "text"
47
45
) {
48
- console . log ( "Invalid message, skipping" , message ) ;
49
- continue ;
50
- }
51
-
52
- // Ignore own messages
53
- if ( message . senderInboxId === client . inboxId ) {
54
46
continue ;
55
47
}
56
48
You can’t perform that action at this time.
0 commit comments