Skip to content

Commit

Permalink
Merge pull request #1 from xmtp-labs/readme
Browse files Browse the repository at this point in the history
Update readme
  • Loading branch information
fabriguespe authored Jun 2, 2024
2 parents 3ad2d45 + b953dcf commit 418c343
Show file tree
Hide file tree
Showing 21 changed files with 33 additions and 83 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dist
.yarn/cache/**
packages/debugger/.yarn/cache/**
packages/playground/.yarn/cache/**
packages/playground/build/**
packages/docs/.yarn/cache/**

# next.js
Expand Down
5 changes: 1 addition & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ To learn more about the contents of this repository, see this README and the REA

### Packages

- [`botkit`](https:/xmtp/botkit/blob/main/packages/botkit): A kit for quickly building bots on the XMTP network
- [`create-xmtp-bot`](https:/xmtp/botkit/blob/main/packages/create-xmtp-bot): A CLI for creating new XMTP bot projects
- [`playground`](https:/xmtp/botkit/blob/main/packages/playground): A visual playground for creating groups
- [`docs`](https:/xmtp/botkit/blob/main/packages/docs): Documentation for botkit
- [`botkit`](/packages/botkit): A kit for quickly building bots on the XMTP network
- [`create-xmtp-bot`](/packages/create-xmtp-bot): A CLI for creating new XMTP bot projects
- [`playground`](/packages/playground): A visual playground for creating groups
- [`docs`](/packages/docs): Documentation for botkit

### Examples

- [`conversational`](https:/xmtp/botkit/blob/main/examples/conversational): A simple, customizable, and powerful conversational framework
- [`gm`](https:/xmtp/botkit/blob/main/examples/gm): A simple bot that responds `gm` to any incoming messages
- [`gpt`](https:/xmtp/botkit/blob/main/examples/gpt): A bot that relays incoming messages to OpenAI's ChatGPT
- [`group`](https:/xmtp/botkit/tree/main/examples/group): Group bot example.
- [`conversational`](/examples/conversational): A simple, customizable, and powerful conversational framework
- [`gm`](/examples/gm): A simple bot that responds `gm` to any incoming messages
- [`gpt`](/examples/gpt): A bot that relays incoming messages to OpenAI's ChatGPT
- [`group`](/examples/group): Group bot example.

See more examples in the [Awesome XMTP ⭐️](https:/xmtp/awesome-xmtp) repo

Expand Down
7 changes: 3 additions & 4 deletions examples/conversational/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,16 @@ cron.schedule(
if (subscriptionStatus === "subscribed") {
console.log(`Sending daily update to ${address}`);
const client = await xmtpClient();
const conversation = await client?.conversations.newConversation(
address
);
const conversation =
await client?.conversations.newConversation(address);
await conversation.send("Here is your daily update!");
}
}
},
{
scheduled: true,
timezone: "UTC",
}
},
);
```
Expand Down
9 changes: 4 additions & 5 deletions examples/conversational/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function start() {
inMemoryCacheStep.set(senderAddress, 0);
await redisClient.del(senderAddress);
await context.reply(
"You are now unsubscribed. You will no longer receive updates!."
"You are now unsubscribed. You will no longer receive updates!.",
);
}

Expand Down Expand Up @@ -65,17 +65,16 @@ async function start() {
console.log(`Sending daily update to ${address}`);
// Logic to send daily updates to each subscriber
const client = await xmtpClient();
const conversation = await client?.conversations.newConversation(
address
);
const conversation =
await client?.conversations.newConversation(address);
await conversation.send("Here is your daily update!");
}
}
},
{
scheduled: true,
timezone: "UTC",
}
},
);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/conversational/src/lib/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const getRedisConfig = async (redisClient: any) => {
const newBotConfig = {
basePersistance: new redisPersistence.RedisPersistence(
redisClient as any,
"xmtp:"
"xmtp:",
),
};
return newBotConfig;
Expand Down
4 changes: 2 additions & 2 deletions examples/gpt/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ run(async (context: HandlerContext) => {
content,
conversationHistory,
message.senderAddress,
systemPrompt
systemPrompt,
);
conversationHistory = messages; // Update the conversation history
await context.reply(reply);
} catch (error) {
// Handle the error, for example, by sending an error message to the user
await context.reply(
"Failed to process your request. Please try again later."
"Failed to process your request. Please try again later.",
);
}
});
2 changes: 1 addition & 1 deletion examples/gpt/src/lib/gpt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default async function openaiCall(
content: string,
messages: any[] = [],
senderAddress: string,
systemPrompt: string
systemPrompt: string,
) {
// Check if the limit of 5 questions per day has been reached
const today = new Date().toISOString().slice(0, 10); // Format: YYYY-MM-DD
Expand Down
2 changes: 1 addition & 1 deletion examples/group/src/lib/gpt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let dailyQuestionCountPerUser: Map<string, Record<string, number>> = new Map();
export default async function openaiCall(
content: string,
senderAddress: string,
systemPrompt: string
systemPrompt: string,
) {
let messages = [
{
Expand Down
12 changes: 5 additions & 7 deletions packages/botkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ For a streamlined setup process, you can use the `create-xmtp-bot` CLI tool, whi
npx init xmtp-bot
```

Please refer to its [documentation](https:/xmtp/botkit/tree/main/create-xmtp-bot).

## Overview

Here's a basic example of the code with a bot that responds with a gm:
Expand All @@ -30,10 +28,10 @@ run(async (context: HandlerContext) => {

## Examples

- [Gm](https:/xmtp/botkit/tree/main/examples/gm): Get started with a simple gm bot.
- [Conversational](https:/xmtp/botkit/tree/main/examples/conversational): Drive retention with conversations and subscriptions with redisDb.
- [GPT](https:/xmtp/botkit/tree/main/examples/gpt): Relay messages through Open AI APIs.
- [Group](https:/xmtp/botkit/tree/main/examples/group): Group bot example.
- [Gm](/examples/gm): Get started with a simple gm bot.
- [Conversational](/examples/conversational): Drive retention with conversations and subscriptions with redisDb.
- [GPT](/examples/gpt): Relay messages through Open AI APIs.
- [Group](/examples/group): Group bot example.

See more examples in the [Awesome XMTP ⭐️](https:/xmtp/awesome-xmtp) repo

Expand All @@ -56,7 +54,7 @@ _Head to the [tutorial on how to deploy an XMTP bot](https://junk-range-possible
To develop on this repo clone the repository containing the bot code:

```bash
git clone https:/xmtp/botkit
git clone https:/xmtp-labs/botkit
cd botkit
# copy env variables template
cp .env.example .env
Expand Down
2 changes: 1 addition & 1 deletion packages/botkit/src/content-types/Reaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class ReactionCodec {
type: ContentTypeReaction,
parameters: {},
content: new TextEncoder().encode(
JSON.stringify({ action, reference, schema, content, receiver })
JSON.stringify({ action, reference, schema, content, receiver }),
),
};
}
Expand Down
8 changes: 4 additions & 4 deletions packages/create-xmtp-bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ yarn start:watch

By default the `create-xmtp-bot` starter comes with a conversational bot but without using a DB. Here are other examples you can use:

- [Gm](https:/xmtp/botkit/tree/main/examples/gm): Get started with a simple gm bot.
- [Conversational](https:/xmtp/botkit/tree/main/examples/conversational): Drive retention with conversations and subscriptions with redisDb.
- [GPT](https:/xmtp/botkit/tree/main/examples/gpt): Relay messages through Open AI APIs.
- [Group](https:/xmtp/botkit/tree/main/examples/group): Group bot example.
- [Gm](/examples/gm): Get started with a simple gm bot.
- [Conversational](/examples/conversational): Drive retention with conversations and subscriptions with redisDb.
- [GPT](/examples/gpt): Relay messages through Open AI APIs.
- [Group](/examples/group): Group bot example.

See more examples in the [Awesome XMTP ⭐️](https:/xmtp/awesome-xmtp) repo
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/docs/docs/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ import { HomePage } from "vocs/components";
<HomePage.Button href="/installation" variant="accent">
Get started
</HomePage.Button>
<HomePage.Button href="https:/xmtp">GitHub</HomePage.Button>
<HomePage.Button href="https:/xmtp-labs">GitHub</HomePage.Button>
</HomePage.Buttons>
</HomePage.Root>
2 changes: 0 additions & 2 deletions packages/docs/docs/pages/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ pnpm create xmtp-bot

:::

Please refer to its [documentation](https:/xmtp/botkit/tree/main/create-xmtp-bot).

## Manual Installation

You can install Botkit in an existing project, or start from scratch, by installing Botkit as a dependency.
Expand Down
File renamed without changes.
Binary file removed packages/playground/build/avatar.png
Binary file not shown.
Binary file removed packages/playground/build/favicon.ico
Binary file not shown.
25 changes: 0 additions & 25 deletions packages/playground/build/manifest.json

This file was deleted.

3 changes: 0 additions & 3 deletions packages/playground/build/robots.txt

This file was deleted.

14 changes: 0 additions & 14 deletions packages/playground/src/Groups/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,6 @@ export function FloatingInbox({
navigator.clipboard.writeText(address);
alert("Address copied to clipboard");
}}>
<a
href="https:/xmtp/dev-inbox"
target="_blank"
rel="noopener noreferrer"
style={styles.labelGithub}>
View on GitHub
</a>
{"Your address: " +
address?.substring(0, 7) +
"..." +
Expand All @@ -438,13 +431,6 @@ export function FloatingInbox({
<div style={styles.label} onClick={createNewWallet}>
or create new one
</div>
<a
href="https:/xmtp/dev-inbox"
target="_blank"
rel="noopener noreferrer"
style={styles.labelGithub2}>
View on GitHub
</a>
</div>
)}
{isConnected && !isOnNetwork && (
Expand Down

0 comments on commit 418c343

Please sign in to comment.