{
  "id": 3222,
  "name": "Multi-functional Discord bot: Llama AI, image generation & knowledge base",
  "description": "Multi-functional Discord Bot with Llama AI, Image Generation, and Knowledge Base Integration \ud83e\udd16\ud83c\udfa8\ud83e\udde0\n## Overview \ud83d\udd0d\nThis workflow creates a Discord bot that can:\n\nMonitor Discord messages from specific users \ud83d\udc40\nProcess different media types (images, audio, text) \ud83d\udd0e\nAnalyze images using AI \ud83d\uddbc\ufe0f\nTranscribe audio files \ud83c\udfa4\nGenerate responses using Llama AI \ud83e\udd99\nCreate images from text prompts using Gemini AI \ud83c\udfa8\n\n## Prerequisites \u2705\n\nn8n automation platform \ud83d\udcbb\nAPI keys for Discord, Groq, Google/Gemini, and SerpAPI \ud83d\udd11\nOllama setup for Llama language model \ud83e\udde0\n\nMain Workflow Components \ud83d\udee0\ufe0f\n1. Message Monitoring System \ud83d\udce8\n\nSet up a Discord receiver to monitor messages in your server \ud83d\udcac\nAdd a filter to only process messages from specific users \ud83d\udd0d\nCreate a wait timer to control how often the bot checks for new messages \u23f1\ufe0f\n\n2. Media Type Detection \ud83d\udd04\n\nCreate a system that detects what kind of content was shared:\n\nAudio files (by checking for waveform data) \ud83c\udfb5\nImages (by checking content type) \ud83d\uddbc\ufe0f\nText (default if no media detected) \ud83d\udcac\n\n\nAdd special detection for image creation commands \ud83c\udfad\n\n3. Image Processing \ud83d\uddbc\ufe0f\n\nFetch the image from Discord \ud83d\udce5\nConvert the image to a format the AI can understand \ud83d\udd04\nSend the image to Groq for analysis \ud83d\udd0d\nReturn the AI's description back to Discord \ud83d\udce4\n\n4. Audio Processing \ud83c\udfb5\n\nFetch the audio file from Discord \ud83d\udce5\nSend it to Groq's audio transcription service \ud83c\udfa4\nProcess the transcribed text with the AI assistant \ud83e\udde0\nReturn the response to Discord \ud83d\udce4\n\n5. Text Processing \ud83d\udcac\n\nSend the text to an AI agent powered by Llama \ud83e\udd99\nConnect the agent to memory to maintain conversation context \ud83e\udde0\nAdd knowledge tools like Wikipedia and search capabilities \ud83d\udd0d\nReturn the AI's response to Discord, with optional text-to-speech \ud83d\udd0a\n\n6. Image Generation \ud83c\udfa8\n\nProcess the user's image creation request \u270f\ufe0f\nUse an AI agent to refine the prompt for better results \u2728\nSend the enhanced prompt to Gemini for image generation \ud83d\udd8c\ufe0f\nExtract the generated image and post it to Discord \ud83d\udce4\n\nConnecting the Components \ud83d\udd17\n\nSet up routing between components based on content type \ud83d\udd00\nEnsure all processes loop back to the message monitoring system \u267b\ufe0f\nAdd wait timers between operations to avoid rate limits \u23f1\ufe0f\n\nTesting Tips \ud83d\udc1b\n\nTest each type of content separately \ud83e\uddea\nVerify API connections and authentication \ud83d\udd10\nCheck if responses are appropriate and timely \u23f0\n\nOptimization Suggestions \u26a1\n\nAdjust wait times based on your usage patterns \u23f1\ufe0f\nAdd more specific filters for message detection \ud83d\udd0d\nConsider implementing caching for frequent requests \ud83d\udcbe\nMonitor performance and adjust as needed \ud83d\udcc8\n\nThis Discord bot combines multiple AI services into a seamless experience, allowing users to interact with various AI capabilities through simple Discord messages. The modular design makes it easy to expand or modify specific features as needed! \ud83d\ude80",
  "categories": [
    {
      "id": 25,
      "name": "AI"
    },
    {
      "id": 47,
      "name": "AI Chatbot"
    }
  ],
  "totalViews": 1316,
  "createdAt": "2025-03-19T15:48:43.764Z",
  "workflow": {
    "meta": {
      "instanceId": "9d20a5e008f7f347cae7522a30fbb1cbf5ac1075dbf6262eec91a04370d1fcd4",
      "templateCredsSetupCompleted": true
    },
    "nodes": [
      {
        "id": "df1968cc-94c7-45dc-8ead-46ae82361602",
        "name": "Window Buffer Memory",
        "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
        "position": [
          340,
          920
        ],
        "parameters": {
          "sessionKey": "={{ $json.content }}{{ $json.output }}{{ $json.text }}",
          "sessionIdType": "customKey",
          "contextWindowLength": 500
        },
        "typeVersion": 1.3
      },
      {
        "id": "196a63dc-e8db-44b1-a1ee-3543dc5aa059",
        "name": "Discord",
        "type": "n8n-nodes-base.discord",
        "position": [
          400,
          680
        ],
        "webhookId": "11bdfa44-14f4-499a-a5c1-27197cd54b64",
        "parameters": {
          "content": "={{ $json.output }}",
          "guildId": {
            "__rl": true,
            "mode": "list",
            "value": "1339725067663315046",
            "cachedResultUrl": "https://discord.com/channels/1339725067663315046",
            "cachedResultName": "Antonis's 2083server"
          },
          "options": {
            "tts": true
          },
          "resource": "message",
          "channelId": {
            "__rl": true,
            "mode": "list",
            "value": "1339725068305170615",
            "cachedResultUrl": "https://discord.com/channels/1339725067663315046/1339725068305170615",
            "cachedResultName": "general"
          },
          "authentication": "oAuth2"
        },
        "credentials": {
          "discordOAuth2Api": {
            "id": "credential-id",
            "name": "discordOAuth2Api Credential"
          }
        },
        "typeVersion": 2
      },
      {
        "id": "6962869e-71dc-48b0-84bf-ee1781bc3aa1",
        "name": "Wait",
        "type": "n8n-nodes-base.wait",
        "position": [
          540,
          680
        ],
        "webhookId": "bd76c196-1fd1-4931-ac5a-e397dee040c1",
        "parameters": {
          "amount": 3
        },
        "typeVersion": 1.1
      },
      {
        "id": "612034bf-cfbd-475d-80bc-d959aad462b2",
        "name": "Wait2",
        "type": "n8n-nodes-base.wait",
        "position": [
          -1020,
          460
        ],
        "webhookId": "a592403a-5af4-485c-a33d-63d9af6454f2",
        "parameters": {
          "amount": 7
        },
        "typeVersion": 1.1
      },
      {
        "id": "a3a09737-cfd0-4e6e-a77b-b633727f1fb9",
        "name": "n8n Trigger",
        "type": "n8n-nodes-base.n8nTrigger",
        "position": [
          -1520,
          660
        ],
        "parameters": {
          "events": [
            "activate",
            "update",
            "init"
          ]
        },
        "typeVersion": 1
      },
      {
        "id": "368c63d6-22f5-4f1a-b97f-61a04fb12bab",
        "name": "Code",
        "type": "n8n-nodes-base.code",
        "position": [
          1700,
          480
        ],
        "parameters": {
          "jsCode": "const items = $input.all();\n\n// Loop through each item\nfor (const item of items) {\n  try {\n    // Check if the item has the expected Gemini response structure\n    if (item && item.json && item.json.candidates && \n        item.json.candidates[0] && \n        item.json.candidates[0].content && \n        item.json.candidates[0].content.parts) {\n      \n      // Find the part that contains the image data\n      const parts = item.json.candidates[0].content.parts;\n      let imageData = null;\n      \n      for (const part of parts) {\n        if (part.inlineData && part.inlineData.data) {\n          imageData = part.inlineData.data;\n          break;\n        }\n      }\n      \n      if (!imageData) {\n        throw new Error('No image data found in the Gemini response');\n      }\n      \n      // If the image data includes a data URI prefix, remove it\n      if (imageData.startsWith('data:')) {\n        imageData = imageData.split(',')[1];\n      }\n      \n      // Convert base64 string to a Buffer\n      const bufferData = Buffer.from(imageData, 'base64');\n      \n      // Ensure 'binary' property exists\n      if (!item.binary) {\n        item.binary = {};\n      }\n      \n      // Attach the binary image data\n      item.binary.data = {\n        data: bufferData,\n        mimeType: 'image/png',\n        fileName: 'generated_image.png'\n      };\n    } else {\n      throw new Error('Input does not match expected Gemini API response structure');\n    }\n  } catch (error) {\n    console.error('Error processing item:', error.message);\n    console.log('Item structure:', JSON.stringify(item, null, 2));\n    throw error;\n  }\n}\n\n// Return the modified items array\nreturn items;"
        },
        "typeVersion": 2
      },
      {
        "id": "5c98dcf6-ea5e-4940-8e64-ac55243ab167",
        "name": "Discord2",
        "type": "n8n-nodes-base.discord",
        "position": [
          1860,
          480
        ],
        "webhookId": "321abf36-3fd4-4669-910d-9753155dfd46",
        "parameters": {
          "files": {
            "values": [
              {
                "inputFieldName": "=data"
              }
            ]
          },
          "content": "=",
          "guildId": {
            "__rl": true,
            "mode": "list",
            "value": "1339725067663315046",
            "cachedResultUrl": "https://discord.com/channels/1339725067663315046",
            "cachedResultName": "Antonis's 2083server"
          },
          "options": {},
          "resource": "message",
          "channelId": {
            "__rl": true,
            "mode": "list",
            "value": "1339725068305170615",
            "cachedResultUrl": "https://discord.com/channels/1339725067663315046/1339725068305170615",
            "cachedResultName": "general"
          },
          "authentication": "oAuth2"
        },
        "credentials": {
          "discordOAuth2Api": {
            "id": "credential-id",
            "name": "discordOAuth2Api Credential"
          }
        },
        "typeVersion": 2
      },
      {
        "id": "130612c1-d73f-440c-bd76-54d1616d0e36",
        "name": "Wait3",
        "type": "n8n-nodes-base.wait",
        "position": [
          2020,
          680
        ],
        "webhookId": "40100215-3e4c-4fcc-80fc-b7dfd9423041",
        "parameters": {
          "amount": 10
        },
        "typeVersion": 1.1
      },
      {
        "id": "965bc8df-1c8e-4fad-b809-e145b13ef6bd",
        "name": "Search",
        "type": "@n8n/n8n-nodes-langchain.toolSerpApi",
        "position": [
          560,
          920
        ],
        "parameters": {
          "options": {
            "gl": "gr",
            "hl": "en",
            "google_domain": "google.com"
          }
        },
        "credentials": {
          "serpApi": {
            "id": "credential-id",
            "name": "serpApi Credential"
          }
        },
        "typeVersion": 1
      },
      {
        "id": "b39d4fc2-54b3-4c3e-aced-43215dcb5f0e",
        "name": "Wikipedia",
        "type": "@n8n/n8n-nodes-langchain.toolWikipedia",
        "position": [
          460,
          920
        ],
        "parameters": {},
        "typeVersion": 1
      },
      {
        "id": "52018e6a-5bef-4f30-a4e6-fd6d73e6492e",
        "name": "Window Buffer Memory1",
        "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
        "position": [
          1440,
          660
        ],
        "parameters": {
          "sessionKey": "={{ $json.text }}{{ $('Users message').item.json.content }}",
          "sessionIdType": "customKey",
          "contextWindowLength": 50
        },
        "typeVersion": 1.3
      },
      {
        "id": "f7b34ba8-8bae-4ebd-ab65-323cdf49d0e6",
        "name": "Discord3",
        "type": "n8n-nodes-base.discord",
        "position": [
          1760,
          140
        ],
        "webhookId": "321abf36-3fd4-4669-910d-9753155dfd46",
        "parameters": {
          "content": "={{ $json.choices[0].message.content }}{{ $json.candidates[0].content.parts[0].text }}",
          "guildId": {
            "__rl": true,
            "mode": "list",
            "value": "1339725067663315046",
            "cachedResultUrl": "https://discord.com/channels/1339725067663315046",
            "cachedResultName": "Antonis's 2083server"
          },
          "options": {},
          "resource": "message",
          "channelId": {
            "__rl": true,
            "mode": "list",
            "value": "1339725068305170615",
            "cachedResultUrl": "https://discord.com/channels/1339725067663315046/1339725068305170615",
            "cachedResultName": "general"
          },
          "authentication": "oAuth2"
        },
        "credentials": {
          "discordOAuth2Api": {
            "id": "credential-id",
            "name": "discordOAuth2Api Credential"
          }
        },
        "typeVersion": 2
      },
      {
        "id": "10e23876-25e1-41cb-a340-a8db842293b9",
        "name": "Convert Binary to Base64",
        "type": "n8n-nodes-base.code",
        "position": [
          1380,
          140
        ],
        "parameters": {
          "jsCode": "const items = $input.all();\n\nfor (const item of items) {\n  if (item.binary && item.binary.data) {\n    const binaryData = item.binary.data;\n    const buffer = binaryData.data;\n    const base64Data = buffer.toString('base64');\n    const mimeType = binaryData.mimeType || 'image/jpeg';\n\n    item.json = {\n      ...item.json,\n      base64Image: base64Data,\n      mimeType: mimeType\n    };\n  } else {\n    throw new Error('No binary data found in item');\n  }\n}\n\nreturn items;"
        },
        "typeVersion": 2
      },
      {
        "id": "37072023-7ab7-4633-8c28-c86265c3d610",
        "name": "Fetch Audio from URL",
        "type": "n8n-nodes-base.httpRequest",
        "position": [
          -360,
          -40
        ],
        "parameters": {
          "url": "={{ $json.attachments[0].url }}",
          "options": {}
        },
        "typeVersion": 4.2
      },
      {
        "id": "cb305f66-d3d0-46f1-8eec-2eb55a85ed7a",
        "name": "Search3",
        "type": "@n8n/n8n-nodes-langchain.toolSerpApi",
        "position": [
          1660,
          660
        ],
        "parameters": {
          "options": {
            "gl": "gr",
            "hl": "en",
            "google_domain": "google.com"
          }
        },
        "credentials": {
          "serpApi": {
            "id": "credential-id",
            "name": "serpApi Credential"
          }
        },
        "typeVersion": 1
      },
      {
        "id": "08be902d-5175-438e-bd11-7bbc1fbc2f5b",
        "name": "Wikipedia3",
        "type": "@n8n/n8n-nodes-langchain.toolWikipedia",
        "position": [
          1560,
          660
        ],
        "parameters": {},
        "typeVersion": 1
      },
      {
        "id": "f96ee8b1-cac9-47cf-a151-13c470e09a11",
        "name": "Reciever",
        "type": "n8n-nodes-base.discord",
        "position": [
          -1180,
          660
        ],
        "webhookId": "0209310a-1eac-4422-94b7-d9d251df6a34",
        "parameters": {
          "limit": 1,
          "guildId": {
            "__rl": true,
            "mode": "list",
            "value": "1339725067663315046",
            "cachedResultUrl": "https://discord.com/channels/1339725067663315046",
            "cachedResultName": "Antonis's 2083server"
          },
          "options": {},
          "resource": "message",
          "channelId": {
            "__rl": true,
            "mode": "list",
            "value": "1339725068305170615",
            "cachedResultUrl": "https://discord.com/channels/1339725067663315046/1339725068305170615",
            "cachedResultName": "general"
          },
          "operation": "getAll",
          "authentication": "oAuth2"
        },
        "credentials": {
          "discordOAuth2Api": {
            "id": "credential-id",
            "name": "discordOAuth2Api Credential"
          }
        },
        "typeVersion": 2,
        "alwaysOutputData": false
      },
      {
        "id": "e174003f-9c72-4a9d-abed-35a1a81987a8",
        "name": "Users message",
        "type": "n8n-nodes-base.if",
        "position": [
          -960,
          660
        ],
        "parameters": {
          "options": {},
          "conditions": {
            "options": {
              "version": 2,
              "leftValue": "",
              "caseSensitive": true,
              "typeValidation": "strict"
            },
            "combinator": "and",
            "conditions": [
              {
                "id": "cc1c45a8-9f18-4059-873f-1e1b5a14e161",
                "operator": {
                  "type": "string",
                  "operation": "equals"
                },
                "leftValue": "={{ $json.author.username }}",
                "rightValue": "=antonis0761"
              }
            ]
          }
        },
        "typeVersion": 2.2
      },
      {
        "id": "de438564-4138-46dd-9609-a1aabaf9495a",
        "name": "Letters OR Voice",
        "type": "n8n-nodes-base.if",
        "position": [
          -780,
          640
        ],
        "parameters": {
          "options": {},
          "conditions": {
            "options": {
              "version": 2,
              "leftValue": "",
              "caseSensitive": true,
              "typeValidation": "strict"
            },
            "combinator": "or",
            "conditions": [
              {
                "id": "30a5311b-1f73-4ff5-9245-ed8033b0dbf2",
                "operator": {
                  "type": "string",
                  "operation": "contains"
                },
                "leftValue": "={{ $json.content }}{{ $json.text }}",
                "rightValue": "image"
              },
              {
                "id": "20b15e33-4eec-4947-95fb-b4375215e514",
                "operator": {
                  "type": "string",
                  "operation": "contains"
                },
                "leftValue": "={{ $json.content }}{{ $json.text }}",
                "rightValue": "picture"
              },
              {
                "id": "778c1a3d-a047-43e5-9aa8-38d63a16775d",
                "operator": {
                  "type": "string",
                  "operation": "exists",
                  "singleValue": true
                },
                "leftValue": "={{ $json.attachments[0].proxy_url }}",
                "rightValue": ""
              }
            ]
          }
        },
        "typeVersion": 2.2
      },
      {
        "id": "a450a83b-dc6b-4002-8387-c896b2eb973d",
        "name": "Google Image Generator",
        "type": "n8n-nodes-base.httpRequest",
        "position": [
          1560,
          480
        ],
        "parameters": {
          "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp:generateContent",
          "method": "POST",
          "options": {},
          "jsonBody": "={\n  \"contents\": [\n    {\n      \"parts\": [\n        {\n          \"text\": \"{{ $json.output }}\"\n        }\n      ]\n    }\n  ],\n  \"generation_config\": {\n    \"response_modalities\": [\"Text\", \"Image\"]\n  }\n}",
          "sendBody": true,
          "sendQuery": true,
          "sendHeaders": true,
          "specifyBody": "json",
          "queryParameters": {
            "parameters": [
              {
                "name": "key",
                "value": "API KEY"
              }
            ]
          },
          "headerParameters": {
            "parameters": [
              {
                "name": "Content-Type",
                "value": "application/json"
              }
            ]
          }
        },
        "typeVersion": 4.2
      },
      {
        "id": "119c552e-7453-4390-a62b-ec311f850707",
        "name": "GROQ Audio To Text",
        "type": "n8n-nodes-base.httpRequest",
        "position": [
          -160,
          -40
        ],
        "parameters": {
          "url": "https://api.groq.com/openai/v1/audio/transcriptions",
          "method": "POST",
          "options": {},
          "sendBody": true,
          "contentType": "multipart-form-data",
          "sendHeaders": true,
          "bodyParameters": {
            "parameters": [
              {
                "name": "model",
                "value": "whisper-large-v3"
              },
              {
                "name": "temperature",
                "value": "0"
              },
              {
                "name": "response_format",
                "value": "json"
              },
              {
                "name": "language",
                "value": "en"
              },
              {
                "name": "file",
                "parameterType": "formBinaryData",
                "inputDataFieldName": "data"
              }
            ]
          },
          "headerParameters": {
            "parameters": [
              {
                "name": "Authorization",
                "value": "bearer"
              }
            ]
          }
        },
        "typeVersion": 4.2
      },
      {
        "id": "ce268902-ee71-489b-8df9-52a1c94dbe45",
        "name": "Fetch Image from Proxy URL",
        "type": "n8n-nodes-base.httpRequest",
        "position": [
          1180,
          140
        ],
        "parameters": {
          "url": "={{ $json.attachments[0].url }}",
          "options": {}
        },
        "typeVersion": 4.2
      },
      {
        "id": "60fcb273-7765-40be-93da-9f9338a8297b",
        "name": "Groq Image To Text",
        "type": "n8n-nodes-base.httpRequest",
        "position": [
          1580,
          140
        ],
        "parameters": {
          "url": "https://api.groq.com/openai/v1/chat/completions",
          "method": "POST",
          "options": {},
          "jsonBody": "={\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"text\",\n          \"text\": \"{{ $json.content }}\"\n        },\n        {\n          \"type\": \"image_url\",\n          \"image_url\": {\n            \"url\": \"{{ $json.attachments[0].url }}\"\n          }\n        }\n      ]\n    }\n  ],\n  \"model\": \"llama-3.2-11b-vision-preview\",\n  \"temperature\": 0.7,\n  \"max_completion_tokens\": 8192,\n  \"top_p\": 1,\n  \"stream\": false,\n  \"stop\": null\n} ",
          "sendBody": true,
          "sendHeaders": true,
          "specifyBody": "json",
          "headerParameters": {
            "parameters": [
              {
                "name": "Authorization",
                "value": "Bearer YOUR_TOKEN_HERE KEY"
              }
            ]
          }
        },
        "typeVersion": 4.2
      },
      {
        "id": "63522dea-ef7c-4bff-b8fb-b9bc525fd3a6",
        "name": "Ollama Chat Model",
        "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
        "position": [
          140,
          920
        ],
        "parameters": {
          "options": {}
        },
        "credentials": {
          "ollamaApi": {
            "id": "credential-id",
            "name": "ollamaApi Credential"
          }
        },
        "typeVersion": 1
      },
      {
        "id": "69b9557f-5317-4ebe-aa18-3555d9f0718e",
        "name": "Ollama Chat Model1",
        "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
        "position": [
          1280,
          660
        ],
        "parameters": {
          "options": {}
        },
        "credentials": {
          "ollamaApi": {
            "id": "credential-id",
            "name": "ollamaApi Credential"
          }
        },
        "typeVersion": 1
      },
      {
        "id": "6aec5a6a-e45c-4afe-bb47-459fcefbab9f",
        "name": "Sticky Note1",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          1180,
          20
        ],
        "parameters": {
          "width": 680,
          "height": 220,
          "content": "This workflow captures Discord messages with images, processes them through the Groq Llama-3.2 vision model, and posts the AI's analysis back to the Discord channel. \ud83d\udcf8 The system fetches images from attachments, converts them to base64 format, and sends both text and image content for comprehensive AI interpretation. \ud83e\udde0 Get instant AI insights on your Discord images with just one message! \u2728\""
        },
        "typeVersion": 1
      },
      {
        "id": "91f2c229-14d1-4a47-86ef-77316c85ca88",
        "name": "Sticky Note",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -360,
          -260
        ],
        "parameters": {
          "color": 7,
          "width": 300,
          "height": 320,
          "content": "This workflow automatically captures audio attachments from Discord messages and transcribes them using Groq's Whisper Large v3 model. \ud83c\udfb5 The system fetches audio files from message attachments and sends them to the AI transcription service, converting spoken words into accurate text. \ud83d\udcdd Get instant transcriptions of voice messages, audio clips, and recordings shared in your Discord server! "
        },
        "typeVersion": 1
      },
      {
        "id": "1f8e4df3-4ad9-4c1d-ad4c-b0f30cc212cf",
        "name": "Sticky Note2",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          40,
          100
        ],
        "parameters": {
          "color": 4,
          "width": 540,
          "height": 280,
          "content": "\ud83d\udd0d Discord Attachment Filter & Processor \ud83e\udde9: This workflow intelligently routes Discord messages based on attachment types and content. \ud83d\uddbc\ufe0f It first checks for waveform images, then filters based on image formats (PNG, JPEG, WebP), and finally processes specific text commands like 'create' or 'make'. \ud83e\udd16 Smart routing ensures each attachment gets handled by the appropriate automation path, delivering tailored responses for different content types! \u2728"
        },
        "typeVersion": 1
      },
      {
        "id": "61f44f7d-1049-4b1d-b167-9ea5b6919394",
        "name": "Sticky Note3",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -1180,
          320
        ],
        "parameters": {
          "color": 6,
          "width": 660,
          "height": 440,
          "content": "\ud83d\udd04 Discord Message Monitor & Analyzer \ud83d\udd75\ufe0f\u200d\u2642\ufe0f: This workflow creates an intelligent loop that fetches and processes messages from a specific Discord channel. \ud83d\udc64 The system identifies messages from a particular user, checks for keywords like 'image' or 'picture', and detects attachments. \ud83d\udd04 With built-in timing controls and text validation, the workflow efficiently cycles through messages, ensuring continuous monitoring and response. \ud83d\ude80 Perfect for creating automated responses to specific user requests and media shares in your Discord server! \u2728"
        },
        "typeVersion": 1
      },
      {
        "id": "e7b3f9aa-37f9-4244-82b0-d6170c3acc67",
        "name": "Sticky Note4",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          100,
          520
        ],
        "parameters": {
          "color": 3,
          "width": 540,
          "height": 260,
          "content": "\ud83e\udde0 Intelligent Discord AI Assistant \ud83e\udd16: This workflow powers a sophisticated AI assistant that responds to Discord messages with contextual awareness and powerful knowledge tools. \ud83d\udd0d The system integrates Ollama's language model with multiple information sources including Wikipedia and web search capabilities. \ud83d\udcac With memory buffer technology, the assistant maintains conversation context across interactions, delivering personalized and relevant responses. \ud83d\udde3\ufe0f Text-to-speech functionality brings messages to life, creating an engaging user experience in your Discord server! \u2728"
        },
        "typeVersion": 1
      },
      {
        "id": "f5142920-021a-4d53-b8d0-cf62c401f186",
        "name": "Sticky Note5",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          1240,
          360
        ],
        "parameters": {
          "color": 3,
          "width": 720,
          "height": 220,
          "content": "\ud83c\udfa8 Discord Image Generation Bot \ud83d\uddbc\ufe0f: This workflow transforms text descriptions into stunning AI-generated images right in your Discord server. \ud83e\udd16 The system uses Ollama's language model to create optimized image prompts from user descriptions, then leverages Google's Gemini model to generate high-quality images. \ud83d\udd04 With built-in data processing, the workflow converts API responses into proper image files before seamlessly posting them back to Discord. \ud83d\udca1 Enhanced with search capabilities and contextual memory, the bot delivers personalized image creations based on user requests! \u2728"
        },
        "typeVersion": 1
      },
      {
        "id": "ca69399e-1466-467c-b298-b9ceb7d27da8",
        "name": "Shorting Voice",
        "type": "n8n-nodes-base.if",
        "position": [
          40,
          240
        ],
        "parameters": {
          "options": {},
          "conditions": {
            "options": {
              "version": 2,
              "leftValue": "",
              "caseSensitive": true,
              "typeValidation": "strict"
            },
            "combinator": "or",
            "conditions": [
              {
                "id": "9a5465ce-44b6-445c-a089-a484022896fb",
                "operator": {
                  "type": "string",
                  "operation": "exists",
                  "singleValue": true
                },
                "leftValue": "={{ $json.attachments[0].waveform }}",
                "rightValue": "image/png"
              }
            ]
          }
        },
        "typeVersion": 2.2
      },
      {
        "id": "a5b13e6b-7edb-476d-9fd6-cd021adb646a",
        "name": "Image Type",
        "type": "n8n-nodes-base.if",
        "position": [
          280,
          260
        ],
        "parameters": {
          "options": {},
          "conditions": {
            "options": {
              "version": 2,
              "leftValue": "",
              "caseSensitive": true,
              "typeValidation": "strict"
            },
            "combinator": "or",
            "conditions": [
              {
                "id": "d24242b4-5b72-4dfa-9143-80b4b72abd37",
                "operator": {
                  "type": "string",
                  "operation": "contains"
                },
                "leftValue": "={{ $json.attachments[0].content_type }}",
                "rightValue": "image/png"
              },
              {
                "id": "b9f84913-b7aa-4d49-91b5-43846266cbb4",
                "operator": {
                  "type": "string",
                  "operation": "contains"
                },
                "leftValue": "={{ $json.attachments[0].content_type }}",
                "rightValue": "image/jpeg"
              },
              {
                "id": "554341df-55d4-4010-a994-4dcf7bc6f790",
                "operator": {
                  "type": "string",
                  "operation": "contains"
                },
                "leftValue": "={{ $json.attachments[0].content_type }}",
                "rightValue": "image/webp"
              }
            ]
          }
        },
        "typeVersion": 2.2
      },
      {
        "id": "c1364ee2-9dd1-466c-8acc-57567070257f",
        "name": "Creating Or Analyzing",
        "type": "n8n-nodes-base.if",
        "position": [
          480,
          280
        ],
        "parameters": {
          "options": {},
          "conditions": {
            "options": {
              "version": 2,
              "leftValue": "",
              "caseSensitive": true,
              "typeValidation": "strict"
            },
            "combinator": "or",
            "conditions": [
              {
                "id": "a46c1125-ca2b-420e-82dc-d2e2d6649ebb",
                "operator": {
                  "type": "string",
                  "operation": "equals"
                },
                "leftValue": "={{ $json.content }}",
                "rightValue": "create"
              },
              {
                "id": "e85bf10f-fab7-4b08-a1f7-e79b38783f97",
                "operator": {
                  "name": "filter.operator.equals",
                  "type": "string",
                  "operation": "equals"
                },
                "leftValue": "={{ $json.content }}",
                "rightValue": "make"
              },
              {
                "id": "855c5939-92ed-428f-8806-b93eb5135db9",
                "operator": {
                  "type": "string",
                  "operation": "equals"
                },
                "leftValue": "={{ $json.text }}",
                "rightValue": "create"
              },
              {
                "id": "dcac6bc2-5e18-4eea-8d56-0afb3ce98207",
                "operator": {
                  "type": "string",
                  "operation": "equals"
                },
                "leftValue": "={{ $json.text }}",
                "rightValue": "make"
              }
            ]
          }
        },
        "typeVersion": 2.2
      },
      {
        "id": "cb5b8226-6a34-4e4f-8847-b20ad02ffc40",
        "name": "General Agent",
        "type": "@n8n/n8n-nodes-langchain.agent",
        "position": [
          100,
          680
        ],
        "parameters": {
          "text": "={{ $json.text }}{{ $json.content }}",
          "options": {
            "systemMessage": "=You are an AI assistant in a Discord server. You process messages, retrieve info from Wikipedia, Notion, Google Sheets, SerpAPI, and Gmail, and maintain context with a memory buffer. Respond concisely, use structured formats, be friendly, cite sources, acknowledge limits, and handle image requests and email tasks appropriately."
          },
          "promptType": "define"
        },
        "typeVersion": 1.7
      },
      {
        "id": "5ffba64b-ea12-4c85-8216-648c60c11d5c",
        "name": "Image Prompter",
        "type": "@n8n/n8n-nodes-langchain.agent",
        "position": [
          1240,
          480
        ],
        "parameters": {
          "text": "={{ $json.text }}{{ $json.content }}",
          "options": {
            "systemMessage": "=Analyze my image description, then create a concise, detailed, realistic prompt (20 words max) without including \"\\n\\n\" in your response.Always have the word \"Create\" at the beggining of your prompt."
          },
          "promptType": "define"
        },
        "typeVersion": 1.7
      }
    ],
    "pinData": {},
    "connections": {
      "Code": {
        "main": [
          [
            {
              "node": "Discord2",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Wait": {
        "main": [
          [
            {
              "node": "Reciever",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Wait2": {
        "main": [
          [
            {
              "node": "Reciever",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Wait3": {
        "main": [
          [
            {
              "node": "Reciever",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Search": {
        "ai_tool": [
          [
            {
              "node": "General Agent",
              "type": "ai_tool",
              "index": 0
            }
          ]
        ]
      },
      "Discord": {
        "main": [
          [
            {
              "node": "Wait",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Search3": {
        "ai_tool": [
          [
            {
              "node": "Image Prompter",
              "type": "ai_tool",
              "index": 0
            }
          ]
        ]
      },
      "Discord2": {
        "main": [
          [
            {
              "node": "Wait3",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Discord3": {
        "main": [
          [
            {
              "node": "Wait3",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Reciever": {
        "main": [
          [
            {
              "node": "Users message",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Wikipedia": {
        "ai_tool": [
          [
            {
              "node": "General Agent",
              "type": "ai_tool",
              "index": 0
            }
          ]
        ]
      },
      "Image Type": {
        "main": [
          [
            {
              "node": "Fetch Image from Proxy URL",
              "type": "main",
              "index": 0
            }
          ],
          [
            {
              "node": "Creating Or Analyzing",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Wikipedia3": {
        "ai_tool": [
          [
            {
              "node": "Image Prompter",
              "type": "ai_tool",
              "index": 0
            }
          ]
        ]
      },
      "n8n Trigger": {
        "main": [
          [
            {
              "node": "Reciever",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "General Agent": {
        "main": [
          [
            {
              "node": "Discord",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Users message": {
        "main": [
          [
            {
              "node": "Letters OR Voice",
              "type": "main",
              "index": 0
            }
          ],
          [
            {
              "node": "Wait2",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Image Prompter": {
        "main": [
          [
            {
              "node": "Google Image Generator",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Shorting Voice": {
        "main": [
          [
            {
              "node": "Fetch Audio from URL",
              "type": "main",
              "index": 0
            }
          ],
          [
            {
              "node": "Image Type",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Letters OR Voice": {
        "main": [
          [
            {
              "node": "Shorting Voice",
              "type": "main",
              "index": 0
            }
          ],
          [
            {
              "node": "General Agent",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Ollama Chat Model": {
        "ai_languageModel": [
          [
            {
              "node": "General Agent",
              "type": "ai_languageModel",
              "index": 0
            }
          ]
        ]
      },
      "GROQ Audio To Text": {
        "main": [
          [
            {
              "node": "Letters OR Voice",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Groq Image To Text": {
        "main": [
          [
            {
              "node": "Discord3",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Ollama Chat Model1": {
        "ai_languageModel": [
          [
            {
              "node": "Image Prompter",
              "type": "ai_languageModel",
              "index": 0
            }
          ]
        ]
      },
      "Fetch Audio from URL": {
        "main": [
          [
            {
              "node": "GROQ Audio To Text",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Window Buffer Memory": {
        "ai_memory": [
          [
            {
              "node": "General Agent",
              "type": "ai_memory",
              "index": 0
            }
          ]
        ]
      },
      "Creating Or Analyzing": {
        "main": [
          [
            {
              "node": "General Agent",
              "type": "main",
              "index": 0
            }
          ],
          [
            {
              "node": "Image Prompter",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Window Buffer Memory1": {
        "ai_memory": [
          [
            {
              "node": "Image Prompter",
              "type": "ai_memory",
              "index": 0
            }
          ]
        ]
      },
      "Google Image Generator": {
        "main": [
          [
            {
              "node": "Code",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Convert Binary to Base64": {
        "main": [
          [
            {
              "node": "Groq Image To Text",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Fetch Image from Proxy URL": {
        "main": [
          [
            {
              "node": "Convert Binary to Base64",
              "type": "main",
              "index": 0
            }
          ]
        ]
      }
    }
  },
  "workflowInfo": {
    "nodeCount": 36,
    "nodeTypes": {
      "n8n-nodes-base.if": {
        "count": 5
      },
      "n8n-nodes-base.code": {
        "count": 2
      },
      "n8n-nodes-base.wait": {
        "count": 3
      },
      "n8n-nodes-base.discord": {
        "count": 4
      },
      "n8n-nodes-base.n8nTrigger": {
        "count": 1
      },
      "n8n-nodes-base.stickyNote": {
        "count": 6
      },
      "n8n-nodes-base.httpRequest": {
        "count": 5
      },
      "@n8n/n8n-nodes-langchain.agent": {
        "count": 2
      },
      "@n8n/n8n-nodes-langchain.toolSerpApi": {
        "count": 2
      },
      "@n8n/n8n-nodes-langchain.lmChatOllama": {
        "count": 2
      },
      "@n8n/n8n-nodes-langchain.toolWikipedia": {
        "count": 2
      },
      "@n8n/n8n-nodes-langchain.memoryBufferWindow": {
        "count": 2
      }
    }
  },
  "nodes": [
    "Window Buffer Memory",
    "Discord",
    "Wait",
    "Wait2",
    "n8n Trigger",
    "Code",
    "Discord2",
    "Wait3",
    "Search",
    "Wikipedia",
    "Window Buffer Memory1",
    "Discord3",
    "Convert Binary to Base64",
    "Fetch Audio from URL",
    "Search3",
    "Wikipedia3",
    "Reciever",
    "Users message",
    "Letters OR Voice",
    "Google Image Generator",
    "GROQ Audio To Text",
    "Fetch Image from Proxy URL",
    "Groq Image To Text",
    "Ollama Chat Model",
    "Ollama Chat Model1",
    "Sticky Note1",
    "Sticky Note",
    "Sticky Note2",
    "Sticky Note3",
    "Sticky Note4",
    "Sticky Note5",
    "Shorting Voice",
    "Image Type",
    "Creating Or Analyzing",
    "General Agent",
    "Image Prompter"
  ],
  "nodeTypes": [
    "@n8n/n8n-nodes-langchain.agent",
    "n8n-nodes-base.httpRequest",
    "n8n-nodes-base.code",
    "n8n-nodes-base.wait",
    "n8n-nodes-base.n8nTrigger",
    "n8n-nodes-base.stickyNote",
    "@n8n/n8n-nodes-langchain.toolWikipedia",
    "@n8n/n8n-nodes-langchain.toolSerpApi",
    "n8n-nodes-base.if",
    "@n8n/n8n-nodes-langchain.lmChatOllama",
    "n8n-nodes-base.discord",
    "@n8n/n8n-nodes-langchain.memoryBufferWindow"
  ]
}