{"id":26238801,"url":"https://github.com/ceramicstudio/discord-agent","last_synced_at":"2026-03-06T08:03:11.906Z","repository":{"id":274835918,"uuid":"920816077","full_name":"ceramicstudio/discord-agent","owner":"ceramicstudio","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-13T01:57:08.000Z","size":1674,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-18T21:35:20.936Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ceramicstudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-22T20:24:27.000Z","updated_at":"2025-05-13T01:55:17.000Z","dependencies_parsed_at":"2025-02-14T21:24:56.263Z","dependency_job_id":"7bf3c1aa-a8e2-42c6-a166-ca173da024ea","html_url":"https://github.com/ceramicstudio/discord-agent","commit_stats":null,"previous_names":["ceramicstudio/discord-agent"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ceramicstudio/discord-agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ceramicstudio%2Fdiscord-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ceramicstudio%2Fdiscord-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ceramicstudio%2Fdiscord-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ceramicstudio%2Fdiscord-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ceramicstudio","download_url":"https://codeload.github.com/ceramicstudio/discord-agent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ceramicstudio%2Fdiscord-agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30166877,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T07:56:45.623Z","status":"ssl_error","status_checked_at":"2026-03-06T07:55:55.621Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-13T06:18:57.795Z","updated_at":"2026-03-06T08:03:11.889Z","avatar_url":"https://github.com/ceramicstudio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Eliza Discord Agent\n\n## Edit the character files\n\nOpen `src/character.ts` to modify the default character. Uncomment and edit.\n\n### Character\n\nEdit the character file found in ./characters/recall.character.json. If you rename this file, you will need to update the hard-coded file path found on line 137 in [this file](src/index.ts).\n\n## Duplicate the .env.example template\n\n```bash\ncp .env.example .env\n```\n\n\\* Fill out the .env file with your own values.\n\n### Add login credentials and keys to .env\n```\nDISCORD_APPLICATION_ID=\"discord-application-id\"\nDISCORD_API_TOKEN=\"discord-api-token\"\nDISCORD_CHANNEL_ID=\"your-channel-id\"\nDISCORD_GUILD_ID=\"your-server-id\"\nOPENAI_API_KEY=\"your-key\"\nPOSTGRES_URL=\"your-pg-url\"\n```\n\nThis agent is currently constrained to only engage in the channel defined in your .env file. You can alter this behavior from the [messaging module](src/plugin-discord/src/messages.ts) on line 109.\n\n### Knowledge Base\n\nThis Discord agent uses a `knowledge base` (specialized knowledge set in vector embedding format) to inject additional context into its responses based on similarity search. Once you've set up your PostgreSQL connection, connect to your database and perform the following:\n\n```sql\nCREATE EXTENSION IF NOT EXISTS vector;\n\nCREATE TABLE code_embeddings (        \n    id SERIAL PRIMARY KEY,\n    file_path TEXT,\n    content  TEXT,\n    embedding VECTOR(1536)\n);\n```\n\nTo pre-load this knowledge base with specialized knowledge (for example, using documentation), you can run a script like the following in a separate file to recursively vectorize file contents within your ./documents directory:\n\n```typescript\nimport { OpenAIEmbeddings } from \"langchain/embeddings/openai\";\nimport { RecursiveCharacterTextSplitter } from \"langchain/text_splitter\";\nimport { TextLoader } from \"langchain/document_loaders/fs/text\";\nimport { DirectoryLoader } from \"langchain/document_loaders/fs/directory\";\nimport { PDFLoader } from \"langchain/document_loaders/fs/pdf\";\nimport { Pool } from 'pg';\n\n\n  const pool = new Pool({\n    connectionString: \"your-connection-url\"\n   });\n  // Configure unified loader for all file types\n  const loader = new DirectoryLoader(\"./documents\", {\n    \".txt\": (path) =\u003e new TextLoader(path),\n    \".md\": (path) =\u003e new TextLoader(path),\n    \".pdf\": (path) =\u003e new PDFLoader(path),\n    \".tsx\": (path) =\u003e new TextLoader(path),\n    \".rs\": (path) =\u003e new TextLoader(path)\n  });\n\n  const docs = await loader.load();\n  const embeddings = new OpenAIEmbeddings();\n  \n  const textSplitter = new RecursiveCharacterTextSplitter({\n    chunkSize: 1000,\n    chunkOverlap: 200,\n    separators: [\"\\n\\n\", \"\\n\", \" \", \"\"]\n  });\n\n  for (const doc of docs) {\n    console.log(`Processing document: ${doc.metadata.source}`);\n    const txtPath = doc.metadata.source;\n    const text = doc.pageContent;\n\n    const chunks = await textSplitter.createDocuments([text]);\n    console.log(`Text split into ${chunks.length} chunks`);\n\n    const embeddingsArrays = await embeddings.embedDocuments(\n      chunks.map((chunk) =\u003e chunk.pageContent.replace(/\\n/g, \" \"))\n    );\n\n    for (let idx = 0; idx \u003c chunks.length; idx++) {\n      const chunk = chunks[idx];\n      const vector = {\n        id: `${txtPath}_${idx}`,\n        values: embeddingsArrays[idx],\n        metadata: {\n          ...chunk.metadata,\n          loc: JSON.stringify(chunk.metadata.loc),\n          pageContent: chunk.pageContent,\n          txtPath: txtPath,\n        },\n      };\n\n      const res = await pool.query(\n        'INSERT INTO code_embeddings (content, file_path, embedding) VALUES ($1, $2, $3::vector)',\n        [\n          chunk.pageContent,\n          txtPath,\n          `[${vector.values.join(',')}]` // Format as array string\n        ]\n      );\n      console.log(res.rows[0], 'inserted from ', txtPath, \":\", chunk.pageContent.slice);\n      await new Promise((resolve) =\u003e setTimeout(resolve, 100));\n      // Add your Postgres insertion logic here\n    }\n    console.log(`Postgres index updated with ${chunks.length} vectors`);\n  }\n```\n\n## Install dependencies and start your agent\n\n```bash\npnpm i \u0026\u0026 pnpm start\n```\nNote: this requires node to be at least version 22 when you install packages and run the agent.\n\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fceramicstudio%2Fdiscord-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fceramicstudio%2Fdiscord-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fceramicstudio%2Fdiscord-agent/lists"}