gm_bot is an automated messaging bot designed to cast a 'gm 🪐' message in Warpcast every day at a scheduled time. The bot operates continuously as long as the system remains online. It leverages Neynar API and is built using @neynar/nodejs-sdk.
- Node.js: A JavaScript runtime built on Chrome's V8 JavaScript engine. Ensure you have Node.js installed on your system.
-
Install Project Dependencies: Navigate to the project directory and run one of the following commands to install all required dependencies:
yarn install # or npm install -
Configure Environment Variables:
- Copy the example environment file:
cp .env.example .env
- Edit
.envto add yourNEYNAR_API_KEYandFARCASTER_DEVELOPER_MNEMONIC. Optionally, you can also specifyPUBLISH_CAST_TIMEandTIME_ZONEfor custom scheduling.
- Copy the example environment file:
Before running the bot, you need to generate a signer and get it approved via an onchain transaction. To execute the transaction, you'll need a browser extension wallet with funded roughly $2 worth of OP ETH on the Optimism mainnet. This is crucial for the bot's operation. Run the following command:
yarn get-approved-signerIn order to get an approved signer you need to do an on-chain transaction on OP mainnet. Go to Farcaster KeyGateway optimism explorer https://optimistic.etherscan.io/address/0x00000000fc56947c7e7183f8ca4b62398caadf0b#writeContract
Connect to Web3.
Navigate to addFor function and add following values inside the respective placeholders. You will see values for fidOwner, keyType, key, metadataType, metadata, deadline, sig in your terminal logs.
Press "Write" to execute the transaction. This will create a signer for your mnemonic on the OP mainnet.
-
Watch the bot: To run the bot in watch mode, use the following command:
yarn watch # or npm run watch -
Start the Bot: Launch the bot using the following command:
yarn start # or npm run start -
Stopping the Bot: If you need to stop the bot, kill the instance.
gm_bot is released under the MIT License. This license permits free use, modification, and distribution of the software, with the requirement that the original copyright and license notice are included in any substantial portion of the work.
- Q1: What if
gm_botstops sending messages?- A1: Check the logs for any errors and ensure your system's time settings align with the specified
TIME_ZONE, also ensure that the process is running.
- A1: Check the logs for any errors and ensure your system's time settings align with the specified