midjourney_client 0.4.1-pre.3
midjourney_client: ^0.4.1-pre.3 copied to clipboard
Unofficial midjourney client that gives you possibility to generates images! Now, it utilizes the Discord API to communicate with the bot.
Unofficial Midjourney Client #
Enhance your creative workflows with the Unofficial Midjourney Client, designed to integrate seamlessly with Discord's Midjourney Bot. Discover the potential of this library, whether you're crafting digital art or exploring new AI-driven frontiers.
Quick Navigation #
Installation #
Flutter Projects #
flutter pub add midjourney_client
Dart Projects #
dart pub add midjourney_client
This command incorporates the
midjourney_client
package along with necessary dependencies into your project.
Getting Started #
import 'dart:async';
import 'package:midjourney_client/midjourney_client.dart';
Future<void> main() async {
var client = MidjourneyClient();
// Initialization with environment variables
await client.initialize(
channelId: Env.channelId,
serverId: Env.serverId,
token: Env.token,
);
// Example: Imagining an Elephant on a tree
var imaginationStream = client.imagine('Elephant on a tree');
imaginationStream.listen(print);
// Retrieving and printing the last item from the stream
var finalImagination = await imaginationStream.last;
print(finalImagination);
}
Configuration #
Prerequisites #
Acquiring Server & Channel IDs #
- Navigate to your Discord server.
- Right-click on the desired channel.
- Select 'Copy ID' for both server and channel.
Obtaining Your Token #
- Log into the Discord Web App.
- Open the developer console (Network tab).
- Send a message or refresh the page.
- Look for the 'Authorization' header in request headers.
- Copy the token value.
Note: The token is sensitive information. Do not share it with anyone.
Examples #
Imagine #
Execute the /imagine
command and showcase the results.
dart run --define=SERVER_ID="" --define=CHANNEL_ID="" --define=TOKEN="" example/imagine.dart
final client = midjourney_client.Midjourney();
await client.initialize(
channelId: Env.channelId,
serverId: Env.serverId,
token: Env.token,
);
final imagine = client.imagine('Cat in a hat');
final result = await imagine.finished;
Variation #
Create a variation on a theme with the Midjourney Bot.
dart run --define=SERVER_ID="" --define=CHANNEL_ID="" --define=TOKEN="" example/variations.dart
await client.initialize(
channelId: Env.channelId,
serverId: Env.serverId,
token: Env.token,
);
final imagine = client.imagine('Cat with sword');
final imagineResult = await imagine.finished;
final variation = client.variation(imagineResult,1);
final result = await variation.finished
Upscale #
Upscale an image for enhanced detail and clarity.
dart run --define=SERVER_ID="" --define=CHANNEL_ID="" --define=TOKEN="" example/upscale.dart
final client = midjourney_client.Midjourney();
await client.initialize(
channelId: Env.channelId,
serverId: Env.serverId,
token: Env.token,
);
final imagine = client.imagine('Cat with asword');
final imagineResult = await imagine.finished;
final upscaled = client.upscale(imagineResult, 1);
final result = await upscaled.finished;
Note: All examples code are located in the
example
folder.