An AI-powered Discord bot that you can speak to inside a Discord voice channel.
To see how this was made, check out my video tutorial.
- AI Assistant powered by OpenAI's Assistant API with custom personality
- Voice interactions with Discord powered by Discord.js, OpenAI's Whisper API and ElevenLabs.
- Direct blockchain interactions through Viem
- Important: Node.js version 22.x is required. Recommend using nvm to install it.
nvm install 22
nvm use 22
- Clone the repository:
git clone https://github.com/jarrodwatts/onchain-agent.git
cd onchain-agent
- Install dependencies:
npm install
-
Create a Discord bot and get your application and the API token.
-
Sign up for OpenAI and get your API key.
-
For blockchain interactions, you'll need a wallet private key. Please DO NOT use a wallet with any real funds.
-
Sign up for ElevenLabs and get your API key and pick a voice ID.
-
Create the
.env
file and add your OpenAI API key and wallet private key:
# OpenAI
OPENAI_API_KEY=
# Wallet
PRIVATE_KEY=
# Discord
DISCORD_APPLICATION_ID=
DISCORD_API_TOKEN=
# Elevenlabs
ELEVENLABS_API_KEY=
ELEVENLABS_VOICE_ID=
- Run the agent:
npm start