Skip to content

GM Agent

A bot that replies GM to any message.

Structure

gm/
├── src/
│   ├── index.ts
├── package.json
├── tsconfig.json
└── .env

Agent

The process that starts listening to messages and replying to them.

src/index.ts
import { createAgent } from "@xmtp/message-kit";
 
export const agent = createAgent({
  name: "Gm Bot",
  tag: "@bot",
  description: "Gm bot.",
  onMessage: async (context) => {
    const { group } = context;
 
    if (!group) {
      await context.send(`gm`);
    }
  },
}).run();

Variables

Set up these variables in your app

cmd
KEY= # the private key of the agent wallet
TEST_ENCRYPTION_KEY= # a different private key for encryption