create-message-kit 1.1.7-beta.1 → 1.1.7-beta.2
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/package.json
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
import { HandlerContext } from "@xmtp/message-kit";
|
2
|
+
|
3
|
+
export async function handler(context: HandlerContext) {
|
4
|
+
const {
|
5
|
+
skills,
|
6
|
+
group,
|
7
|
+
message: {
|
8
|
+
content: { command },
|
9
|
+
},
|
10
|
+
} = context;
|
11
|
+
|
12
|
+
if (command == "help") {
|
13
|
+
const intro =
|
14
|
+
"Available experiences:\n" +
|
15
|
+
skills
|
16
|
+
?.flatMap((app) => app.skills)
|
17
|
+
.map((skill) => `${skill.command} - ${skill.description}`)
|
18
|
+
.join("\n") +
|
19
|
+
"\nUse these skills to interact with specific apps.";
|
20
|
+
context.send(intro);
|
21
|
+
} else if (command == "id") {
|
22
|
+
context.send(context.group?.id);
|
23
|
+
}
|
24
|
+
}
|
@@ -1,21 +1,18 @@
|
|
1
1
|
import { run, HandlerContext } from "@xmtp/message-kit";
|
2
|
-
import { handler as splitpayment } from "./handler/splitpayment.js";
|
3
2
|
|
4
3
|
// Main function to run the app
|
5
4
|
run(
|
6
5
|
async (context: HandlerContext) => {
|
7
6
|
const {
|
8
7
|
message: { typeId },
|
8
|
+
group,
|
9
9
|
} = context;
|
10
10
|
switch (typeId) {
|
11
11
|
case "reply":
|
12
12
|
handleReply(context);
|
13
13
|
break;
|
14
|
-
case "remoteStaticAttachment":
|
15
|
-
handleAttachment(context);
|
16
|
-
break;
|
17
14
|
}
|
18
|
-
if (!
|
15
|
+
if (!group) {
|
19
16
|
context.send("This is a group bot, add this address to a group");
|
20
17
|
}
|
21
18
|
},
|
@@ -38,20 +35,3 @@ async function handleReply(context: HandlerContext) {
|
|
38
35
|
);
|
39
36
|
//await context.skill(chain);
|
40
37
|
}
|
41
|
-
|
42
|
-
// Handle attachment messages
|
43
|
-
async function handleAttachment(context: HandlerContext) {
|
44
|
-
await splitpayment(context);
|
45
|
-
}
|
46
|
-
|
47
|
-
export async function helpHandler(context: HandlerContext) {
|
48
|
-
const { skills } = context;
|
49
|
-
const intro =
|
50
|
-
"Available experiences:\n" +
|
51
|
-
skills
|
52
|
-
?.flatMap((app) => app.skills)
|
53
|
-
.map((skill) => `${skill.command} - ${skill.description}`)
|
54
|
-
.join("\n") +
|
55
|
-
"\nUse these skills to interact with specific apps.";
|
56
|
-
context.send(intro);
|
57
|
-
}
|
@@ -3,7 +3,7 @@ import { handler as agent } from "./handler/agent.js";
|
|
3
3
|
import { handler as transaction } from "./handler/transaction.js";
|
4
4
|
import { handler as games } from "./handler/game.js";
|
5
5
|
import { handler as loyalty } from "./handler/loyalty.js";
|
6
|
-
import {
|
6
|
+
import { handler as groupHelp } from "./handler/group.js";
|
7
7
|
import type { SkillGroup } from "@xmtp/message-kit";
|
8
8
|
|
9
9
|
export const skills: SkillGroup[] = [
|
@@ -31,6 +31,7 @@ export const skills: SkillGroup[] = [
|
|
31
31
|
},
|
32
32
|
],
|
33
33
|
},
|
34
|
+
|
34
35
|
{
|
35
36
|
name: "Transactions",
|
36
37
|
description: "Multipurpose transaction frame built onbase.",
|
@@ -159,10 +160,18 @@ export const skills: SkillGroup[] = [
|
|
159
160
|
command: "/help",
|
160
161
|
triggers: ["/help"],
|
161
162
|
examples: ["/help"],
|
162
|
-
handler:
|
163
|
+
handler: groupHelp,
|
163
164
|
description: "Get help with the bot.",
|
164
165
|
params: {},
|
165
166
|
},
|
167
|
+
{
|
168
|
+
command: "/id",
|
169
|
+
adminOnly: true,
|
170
|
+
handler: groupHelp,
|
171
|
+
triggers: ["/id"],
|
172
|
+
description: "Get the group ID.",
|
173
|
+
params: {},
|
174
|
+
},
|
166
175
|
],
|
167
176
|
},
|
168
177
|
];
|