create-message-kit 1.2.0 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -9,7 +9,7 @@ export const registerSkill: Skill[] = [
|
|
9
9
|
skill: "/todo",
|
10
10
|
handler: handler,
|
11
11
|
examples: ["/todo"],
|
12
|
-
description: "
|
12
|
+
description: "Summarize your TODOs and send an email with the summary. Receives no parameters.",
|
13
13
|
params: {},
|
14
14
|
},
|
15
15
|
];
|
@@ -23,7 +23,8 @@ export async function handler(context: XMTPContext) {
|
|
23
23
|
|
24
24
|
let email = "";
|
25
25
|
|
26
|
-
|
26
|
+
let intents=2
|
27
|
+
while (intents>0) {
|
27
28
|
const emailResponse = await context.awaitResponse("Please provide your email address to receive the TODO summary:");
|
28
29
|
email = emailResponse;
|
29
30
|
|
@@ -31,11 +32,15 @@ export async function handler(context: XMTPContext) {
|
|
31
32
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
32
33
|
if (!emailRegex.test(email)) {
|
33
34
|
await context.send("Invalid email format. Please try again with a valid email address.");
|
35
|
+
intents--;
|
34
36
|
continue;
|
35
37
|
}
|
36
38
|
break;
|
37
39
|
}
|
38
|
-
|
40
|
+
if(intents==0){
|
41
|
+
await context.send("I couldn't get your email address. Please try again later.");
|
42
|
+
return;
|
43
|
+
}
|
39
44
|
try {
|
40
45
|
let content={
|
41
46
|
from: 'onboarding@resend.dev',
|
@@ -47,8 +52,8 @@ export async function handler(context: XMTPContext) {
|
|
47
52
|
`
|
48
53
|
}
|
49
54
|
console.log(content);
|
50
|
-
const response = await resend.emails.send(content);
|
51
|
-
console.log(response);
|
55
|
+
// const response = await resend.emails.send(content);
|
56
|
+
// console.log(response);
|
52
57
|
|
53
58
|
await context.send(`✅ Summary sent successfully to ${email}`);
|
54
59
|
} catch (error) {
|
@@ -9,7 +9,7 @@ Your are helpful and playful web3 agent called {agent_name} that lives inside a
|
|
9
9
|
|
10
10
|
## Common Issues
|
11
11
|
1. Missing commands in responses
|
12
|
-
**Issue**: Sometimes responses
|
12
|
+
**Issue**: Sometimes responses are sent without the required command.
|
13
13
|
**Example**:
|
14
14
|
Incorrect:
|
15
15
|
> "Looks like vitalik.eth is registered! What about these cool alternatives?"
|