midjourney api by discord
- Imagine
- Scale
- Select
wait pr
-
Create console app
mkdir Midjourney.Example.Console && cd Midjourney.Example.Console dotnet new console dotnet add package MidjourneyAPI --version 1.0.0-beta.2305181719 dotnet add package Micorsoft.Extensions.Logging.Console dotnet add pacakge Micorsoft.Extensions.DependencyInjection
-
Edit
Program.csvar services = new ServiceCollection(); services.AddLogging(builder => { builder.SetMinimumLevel(LogLevel.Debug); builder.AddConsole(); }); services.AddMidjourney(builder => { // Note: Please set your custome info. builder.Option.DiscordToken = "<your discord authorization value>"; builder.Option.ChannelId = "<your discord server id>"; builder.Option.ServerId = "<your midjourney bot channelId in discord>"; }); var provider = services.BuildServiceProvider(); var midjourney = provider.GetRequiredService<Midjourney>() ?? throw new ArgumentNullException(nameof(Midjourney)); // Imagine await midjourney.ImagineAsync("Labrador", loading: (message) => { Console.WriteLine(message.Progress); if (message.Progress == "done") { Console.WriteLine($"{message.Content} -> {message.Url}"); } return Task.CompletedTask; });
-
Run your code for
dotnet run
-
Get
DiscordToken -
Get
ServerIdPress
F12, Open your discordServer profile, Find/profileforNetworkingand viewpayload, selectguild_idinmutual_guilds -
Get
ChannelIdPress
F12, Select click your channel in discord, Find/messagesforNetworkingand viewpayload, selectchannel_idin data list
-
git clone
https://github.com/binwan-dev/MidjourneyAPI -
config
SalaiTokenServerIdChannelIdatProgram.csinsrc/example/MidjourneyAPI.Exampleservices.AddMidjourney(builder => { builder.Option.DiscordToken = "<your discord authorization value>"; builder.Option.ChannelId = "<your discord server id>"; builder.Option.ServerId = "<your midjourney bot channelId in discord>"; });
-
run
examplecd MidjourneyAPI/src/example/MidjourneyAPI.Example.Console dotnet run
https://github.com/erictik/midjourney-api
The project is to be used for educational purposes only