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 CHANGED
@@ -13,7 +13,7 @@ npx create-message-kit@latest
13
13
  ```
14
14
 
15
15
  ```bash
16
- yarn create message-kit
16
+ yarn create message-kit@latest
17
17
  ```
18
18
 
19
19
  ```bash [npm]
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,6 +1,6 @@
1
1
  {
2
2
  "name": "create-message-kit",
3
- "version": "1.1.7-beta.26",
3
+ "version": "1.1.7-beta.27",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -1,14 +1,20 @@
1
1
  import { run, HandlerContext } from "@xmtp/message-kit";
2
- import { skills } from "./skills.js";
3
- run(
4
- async (context: HandlerContext) => {
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
- // To reply, just call `reply` on the HandlerContext
9
- await context.send(`gm`);
10
- },
11
- {
12
- skills: skills,
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
- ];