@virtuals-protocol/game-farcaster-plugin
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Farcaster Plugin for Virtuals Game

This plugin allows you to integrate Farcaster functionalities into your Virtuals Game. With this plugin, you can post casts on the Farcaster network.

Installation

To install the plugin, use npm or yarn:

npm install @virtuals-protocol/game-farcaster-plugin

or

yarn add @virtuals-protocol/game-farcaster-plugin

Usage

Importing the Plugin

First, import the FarcasterPlugin class from the plugin:

import FarcasterPlugin from "@virtuals-protocol/game-farcaster-plugin";

Creating a Worker

Create a worker with the necessary Farcaster credentials:

const farcasterPlugin = new FarcasterPlugin({
  credentials: {
    neynarApiKey: "your_neynar_api_key"
  },
});

Creating an Agent

Create an agent and add the worker to it:

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

const agent = new GameAgent("API_KEY", {
  name: "Farcaster Bot",
  goal: "Engage with the Farcaster community",
  description: "A bot that can post casts on Farcaster",
  workers: [farcasterPlugin.getWorker()],
});

Running the Agent

Initialize and run the agent:

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

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

Available Functions

The FarcasterPlugin currently provides the following function:

  • postCastFunction: Post a new cast to Farcaster. Takes two arguments:
    • text: The content of the cast
    • cast_reasoning: The reasoning behind the cast

License

This project is licensed under the MIT License.

Readme

Keywords

none

Package Sidebar

Install

npm i @virtuals-protocol/game-farcaster-plugin

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

11.4 kB

Total Files

6

Last publish

Collaborators

  • vituals
  • zuhwa
  • jsoh0118