Documentation

Dependencies

Usage

Required Libraries

Make sure to install the required libraries before running the code:

npm install axios

Example Response

{
  "ok": true,
  "result": {
    "image": "base64 image",
    "type": "quote",
    "width": 512,
    "height": 359
  }
}
  

Javascript

const axios = require('axios');
const fs = require('fs');

const text = "Hello World";
const username = "Bot";
const avatar = "https://telegra.ph/file/a3fdac3ba48f3f363e696.png";

const json = {
  "type": "quote",
  "format": "png",
  "backgroundColor": "#FFFFFF",
  "width": 512,
  "height": 768,
  "scale": 2,
  "messages": [
    {
      "entities": [],
      "avatar": true,
      "from": {
        "id": 1,
        "name": username,
        "photo": {
          "url": avatar
        }
      },
      "text": text,
      "replyMessage": {}
    }
  ]
};

const response = axios.post('https://btzqc.betabotz.eu.org/generate', json, {
  headers: {'Content-Type': 'application/json'}
}).then(res => {
  const buffer = Buffer.from(res.data.result.image, 'base64');
  fs.writeFile('Quotly.png', buffer, (err) => {
    if (err) throw err;
  });
});

Python

import requests
import base64

text = "Hello World"
username = "Bot" 
avatar = "https://telegra.ph/file/a3fdac3ba48f3f363e696.png"

json = {
  "type": "quote",
  "format": "webp",
  "backgroundColor": "#FFFFFF",
  "width": 512,
  "height": 768,
  "scale": 2,
  "messages": [
    {
      "entities": [],
      "avatar": True,
      "from": {
        "id": 1,
        "name": username,
        "photo": {
          "url": avatar
        }
      },
      "text": text,
      "replyMessage": {}
    }
  ]
}

response = requests.post('https://btzqc.betabotz.eu.org/generate', json=json).json()
buffer = base64.b64decode(response['result']['image'].encode('utf-8'))
open('Quotly.png', 'wb').write(buffer)
print('Quotly.png')
  

Explanation

The code utilizes the Axios library for making HTTP requests and the fs library for writing files. It generates a quote image using the provided JSON data and saves it as a PNG file named "Quotly.png".

Variables

Request

The code sends a POST request to the URL "https://qc.botcahx.eu.org/generate" with the JSON data. The request is made with the header "Content-Type: application/json".

Response

Upon receiving a response from the server, the code converts the image data from base64 format to a buffer. It then writes the buffer to a file named "Quotly.png" using the fs library.

API Request Body

Body Type Description
type string Output image type. May be: quote, image, null
backgroundColor string Quote background color. Can be Hex, name or random for a random color
messages array Array of messages
width number Maximum width
height number Maximum height
scale number Scale

JSON Response


  {
  "type": "quote",
  "format": "png",
  "backgroundColor": "#1b1429",
  "width": 512,
  "height": 768,
  "scale": 2,
  "messages": [
    {
      "entities": [],
      "chatId": 66478514,
      "avatar": true,
      "from": {
        "id": 66478514,
        "first_name": "John Due",
        "last_name": "Tele",
        "username": "Bot",
        "language_code": "id",
        "title": "John Due",
        "photo": {
          "small_file_id": "AQADAgADCKoxG7Jh9gMACBbSEZguAAMCAAOyYfYDAATieVimvJOu7M43BQABHgQ",
          "small_file_unique_id": "AQADFtIRmC4AA843BQAB",
          "big_file_id": "AQADAgADCKoxG7Jh9gMACBbSEZguAAMDAAOyYfYDAATieVimvJOu7NA3BQABHgQ",
          "big_file_unique_id": "AQADFtIRmC4AA9A3BQAB"
        },
        "type": "private",
        "name": "John Due"
      },
      "text": "John Due",
      "replyMessage": {}
    }
  ]
}
  

Media


  {
  "type": "quote",
  "format": "png",
  "backgroundColor": "#1b1429",
  "width": 512,
  "height": 768,
  "scale": 2,
  "messages": [
    {
      "media": [
        {
          "file_id": "CAACAgIAAxkBAAIyH2AAAUcJoPJqv4uOPabtiSR3judSnQACaQEAAiI3jgQe29BUaNTqrx4E",
          "file_size": 22811,
          "height": 512,
          "width": 512
        }
      ],
      "mediaType": "sticker",
      "chatId": 66478514,
      "avatar": true,
      "from": {
        "id": 66478514,
        "first_name": "John Due",
        "last_name": "Tele",
        "username": "Bot",
        "language_code": "id",
        "title": "John Due",
        "photo": {
          "small_file_id": "AQADAgADCKoxG7Jh9gMACBbSEZguAAMCAAOyYfYDAATieVimvJOu7M43BQABHgQ",
          "small_file_unique_id": "AQADFtIRmC4AA843BQAB",
          "big_file_id": "AQADAgADCKoxG7Jh9gMACBbSEZguAAMDAAOyYfYDAATieVimvJOu7NA3BQABHgQ",
          "big_file_unique_id": "AQADFtIRmC4AA9A3BQAB"
        },
        "type": "private",
        "name": "John Due"
      },
      "replyMessage": {}
    }
  ]
}
  

Without Telegram

    
  {
  "type": "quote",
  "format": "png",
  "backgroundColor": "#1b1429",
  "width": 512,
  "height": 768,
  "scale": 2,
  "messages": [
    {
      "entities": [],
      "media": {
        "url": "https://via.placeholder.com/1000"
      },
      "avatar": true,
      "from": {
        "id": 1,
        "name": "Bot",
        "photo": {
          "url": "https://via.placeholder.com/100"
        }
      },
      "text": "Hey",
      "replyMessage": {}
    }
  ]
}