Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:A616567126 GPT WEB JAVA ConvertUtils

From Leeroopedia
Knowledge Sources
Domains Midjourney, Content_Parsing
Last Updated 2026-10-13 00:00 GMT

Overview

Concrete utility class for parsing Midjourney Discord message content, converting base64 image data, and extracting task change parameters from button actions.

Description

The ConvertUtils class provides three key functions: `parseContent()` extracts prompt text and progress status from MJ message content using regex, `convertBase64Array()` converts base64-encoded image strings to `DataUrl` objects, and `convertChangeParams()` parses button action strings (like "12345 u1") into `TaskChangeParams` with action type (UPSCALE/VARIATION/REROLL) and index.

Usage

Use this utility when processing Midjourney Discord messages to extract prompts, parse action buttons, or convert image data.

Code Reference

Source Location

Signature

@UtilityClass
public class ConvertUtils {

    public static final String CONTENT_REGEX = ".*?\\*\\*(.*?)\\*\\*.+<@\\d+> \\((.*?)\\)";

    public static ContentParseData parseContent(String content);
    public static ContentParseData parseContent(String content, String regex);
    public static List<DataUrl> convertBase64Array(List<String> base64Array) throws MalformedURLException;
    public static TaskChangeParams convertChangeParams(String content);
}

Import

import com.intelligent.bot.utils.mj.ConvertUtils;

I/O Contract

Inputs

Name Type Required Description
content String Yes MJ Discord message content
base64Array List<String> Yes List of base64 image strings

Outputs

Name Type Description
parseContent ContentParseData Extracted prompt and status
convertBase64Array List<DataUrl> Parsed data URL objects
convertChangeParams TaskChangeParams Action type and index, or null

Usage Examples

Parse MJ Message Content

// Content: "**a cute cat** - <@123456> (100%)"
ContentParseData data = ConvertUtils.parseContent(content);
// data.getPrompt() = "a cute cat"
// data.getStatus() = "100%"

Parse Button Action

// Content: "1234567890 U1"
TaskChangeParams params = ConvertUtils.convertChangeParams("1234567890 U1");
// params.getId() = 1234567890
// params.getAction() = TaskAction.UPSCALE
// params.getIndex() = 1

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment