create-message-kit 1.1.7-beta.26 → 1.1.7-beta.27
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/index.js +5 -1
- package/package.json +1 -1
- package/templates/gm/src/index.ts +18 -12
- package/templates/gm/src/skills.ts +0 -29
package/README.md
CHANGED
package/index.js
CHANGED
@@ -91,7 +91,11 @@ async function addPackagejson(destDir, name, pkgManager) {
|
|
91
91
|
};
|
92
92
|
|
93
93
|
if (pkgManager.startsWith("yarn")) {
|
94
|
-
packageTemplate.packageManager = pkgManager;
|
94
|
+
packageTemplate.packageManager = pkgManager; // Add .yarnrc.yml to disable PnP mode
|
95
|
+
fs.writeFileSync(
|
96
|
+
resolve(destDir, ".yarnrc.yml"),
|
97
|
+
"nodeLinker: node-modules\n",
|
98
|
+
);
|
95
99
|
}
|
96
100
|
fs.writeJsonSync(resolve(destDir, "package.json"), packageTemplate, {
|
97
101
|
spaces: 2,
|
package/package.json
CHANGED
@@ -1,14 +1,20 @@
|
|
1
1
|
import { run, HandlerContext } from "@xmtp/message-kit";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
// Get the message and the address from the sender
|
6
|
-
const { content, sender } = context.message;
|
2
|
+
run(async (context: HandlerContext) => {
|
3
|
+
// To reply, just call `reply` on the HandlerContext
|
4
|
+
await context.send(`gm`);
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
)
|
6
|
+
// Set the awaited handler to process the user's response
|
7
|
+
context.setAwaitedHandler(async (responseContext: HandlerContext) => {
|
8
|
+
console.log("awaited handler");
|
9
|
+
const userResponse = responseContext?.message?.content?.text?.toLowerCase();
|
10
|
+
if (userResponse === "yes") {
|
11
|
+
await responseContext.send("Action confirmed.");
|
12
|
+
} else if (userResponse === "no") {
|
13
|
+
await responseContext.send("Action canceled.");
|
14
|
+
} else {
|
15
|
+
await responseContext.send("Please respond with 'yes' or 'no'.");
|
16
|
+
// Re-set the handler to await the correct response again
|
17
|
+
context.setAwaitedHandler(responseContext?.awaitedHandler!);
|
18
|
+
}
|
19
|
+
});
|
20
|
+
});
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import type { SkillGroup } from "@xmtp/message-kit";
|
2
|
-
|
3
|
-
export const skills: SkillGroup[] = [
|
4
|
-
{
|
5
|
-
name: "Group bot",
|
6
|
-
tag: "@bot",
|
7
|
-
description: "Group bot for tipping and transactions.",
|
8
|
-
skills: [
|
9
|
-
{
|
10
|
-
skill: "/tip [usernames] [amount] [token]",
|
11
|
-
triggers: ["/tip"],
|
12
|
-
examples: ["/tip @vitalik 10 usdc"],
|
13
|
-
description: "Tip users in a specified token.",
|
14
|
-
handler: undefined,
|
15
|
-
params: {
|
16
|
-
username: {
|
17
|
-
default: "",
|
18
|
-
plural: true,
|
19
|
-
type: "username",
|
20
|
-
},
|
21
|
-
amount: {
|
22
|
-
default: 10,
|
23
|
-
type: "number",
|
24
|
-
},
|
25
|
-
},
|
26
|
-
},
|
27
|
-
],
|
28
|
-
},
|
29
|
-
];
|