Skip to content

TwitterBounty Plugin #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions plugins/bountyPlugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
node_modules/
2 changes: 2 additions & 0 deletions plugins/bountyPlugin/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src
tsconfig.json
87 changes: 87 additions & 0 deletions plugins/bountyPlugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Twitter Plugin for Virtuals Game

This plugin allows you to integrate Twitter functionalities into your Virtuals Game. With this plugin, you can post tweets, reply to tweets, like tweets, and more.

## Installation

To install the plugin, use npm or yarn:

```bash
npm install @virtuals-protocol/game-twitter-plugin
```

or

```bash
yarn add @virtuals-protocol/game-twitter-plugin
```

## Usage

### Importing the Plugin

First, import the `TwitterPlugin` class from the plugin:

```typescript
import TwitterPlugin from "@virtuals-protocol/game-twitter-plugin";
```

### Creating a Worker

Create a worker with the necessary Twitter credentials:

```typescript
const twitterPlugin = new TwitterPlugin({
credentials: {
apiKey: "your_api_key",
apiSecretKey: "your_api_secret_key",
accessToken: "your_access_token",
accessTokenSecret: "your_access_token_secret",
},
});
```

### Creating an Agent

Create an agent and add the worker to it:

```typescript
import { GameAgent } from "@virtuals-protocol/game";

const agent = new GameAgent("API_KEY", {
name: "Twitter Bot",
goal: "Increase engagement and grow follower count",
description: "A bot that can post tweets, reply to tweets, and like tweets",
workers: [twitterPlugin.getWorker()],
});
```

### Running the Agent

Initialize and run the agent:

```typescript
(async () => {
await agent.init();

while (true) {
await agent.step({
verbose: true,
});
}
})();
```

## Available Functions

The `TwitterPlugin` provides several functions that can be used by the agent:

- `searchTweetsFunction`: Search for tweets based on a query.
- `replyTweetFunction`: Reply to a tweet.
- `postTweetFunction`: Post a new tweet.
- `likeTweetFunction`: Like a tweet.
- `quoteTweetFunction`: Quote a tweet with your own commentary.

## License

This project is licensed under the MIT License.
Loading