中文说明README_CN.md
This is a Python client for the unofficial MidJourney API, This implementation uses a Discord self bot, and utilizes this library: Merubokkusu/Discord-S.C.U.M. Please be aware that there might be a risk of being banned.
*** risky actions: issue #66
- Info
- Imagine prompt
- Image Upscale and Vectorize by label
- All messages return via WebSocket, including banned words check and image processing
- Auto reconnect WebSocket
- status for execute command (imagine, interact), failed or success
- Multi-account support
- Full support for all MidJourney APIs
# use pip, create visual env
python -m venv .venv
pip install -r requirements.txt
poetry install
cp config.example.py config.py
python main.py
python client.py
python test.py
Multiple accounts need to be configured in config.py
, each account requires the following fields: name
, token
, application_id
, guild_id
and channel_id
.
The Python program will start two threads:
-
One thread is used to receive messages from Redis and dispatch to subprocesses.
-
The other thread is used to manage subprocesses.
The subprocess management thread will start one process for each account based on account configurations. Each process will have two threads:
- Redis receiving thread: receive tasks and assemble messages. The message queue name is `midjounery_task`. The message format is as follows:
{
"cmd": string, command to execute, currently supports "imagine" and "interact",
"args": array, arguments passed to the command, "imagine" only has one string "prompt", "interact" has two params "message_id" and "label",
"channel_id": which channel to send the execution to, "imagine" can be omitted, program will randomly schedule across accounts, "interact" must pass the correct "channel_id".
}
- Redis sending thread: sends real-time WSS messages. The message queue name is `midjounery_notification`.
The program flow is as follows:
-
Send messages from Redis task queue.
-
The main process receives the message, and randomly selects a channel if "channel_id" is not present.
-
Send to each subprocess through inter-process communication queue.
-
Each account subprocess will receive this message, but only process tasks matching its own "channel_id", other tasks will be ignored.
-
After receiving the task, the subprocess will call its internal function to execute.
-
The execution result is listened via WSS, then sent externally via Redis queue.
- discord : https://discord.gg/AJSGUVeMd9
Loved the project? Condider buy me a coffee :D Kofi