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.
flutter pub add midjourney_client
dart pub add midjourney_client
This command incorporates the
midjourney_client
package along with necessary dependencies into your project.
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);
}
Note: The token is sensitive information. Do not share it with anyone.
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;
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 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.