├── .github └── FUNDING.yml ├── .gitignore ├── LICENSE ├── README.md ├── index.js ├── package.json └── src ├── config └── config.json ├── console └── watermark.js ├── events └── client │ ├── interactionCreate.js │ └── ready.js ├── handlers ├── event.js └── slash.js └── slashCommands └── information ├── imagine.js ├── ping.js └── prompts.js /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: sandarutharuneth 2 | patreon: openjourney 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | package-lock.json -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2023, Sandaru Tharuneth 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | 3. Neither the name of the copyright holder nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Discord Midjourney Bot 2 | 3 | A opensource Discord Midjourney bot for all AI lovers. No more paywalls to AI. Enjoy your AI Art freedom with us* 4 | 5 | # 6 | 7 | # 8 | 9 | > [!CAUTION] 10 | > **Replicate changed their platform on how free users can use their service since I made this bot. Now, after a few API requests, you have to add a valid payment method to continue using Replicate. You're always welcome to use our Openjourney bot for free as well.** 11 | 12 | > [!NOTE] 13 | > New Opensource version of our Discord bot coming soon equiped with our [**Openjourney API**](https://docs.opj.app/). Stay tuned and Follow [**Openjourney Neural Labs**](https://github.com/Openjourney-Neural-Labs) to get updates! 14 | 15 | ## Invite Openjourney Bot => Click Here 16 | > **Trusted and enjoyed by more than 10000+ servers** 17 | 18 | 19 | 20 | # 21 | 22 | ## Cutting Edge Features 23 | > These are the features that makes you wanna use our bot. Check it out! 24 | 25 | - Text to Image 26 | - Image to Text 27 | - Image to Image 28 | - Logo generation 29 | - Flux Molde access 30 | - SDXL & SD3 Model access 31 | - Face Swap ( Swap faces ) 32 | - Headshot generation 33 | - Controlnet ( Turn your sketches into a image ) 34 | - Image clarification ( Fix blurred images ) 35 | - Remove Background with AI 36 | - Image Transformation / Replication 37 | - Face Restoration ( gfpgan ) 38 | - Super Upscaling up to 8K 39 | - Fully advanced customizable image generations 40 | - Llama 2 & 3 language model access ( From META Inc ) 41 | - Customizable canvas sizes ( Square, Portrait, Landscape ) 42 | 43 | # [INVITE NOW ⭐️](https://openjourneybot.com) 44 | 45 | # 46 | 47 | ## Like To Support? 48 | > [!NOTE] 49 | > We are actively looking for **Partnerships/Investors** to our Openjourney Project. If you are willing to be a part of this amazing journey, please contact us via the contact methods below. 50 | 51 | - Contact us via our official Mail: **press@openjourneybot.com** 52 | - Contact us via our Discord Server: **Openjourney** 53 | 54 | 55 |

Donate Us:

56 |

sandarudev 57 |

58 | 59 | # 60 | 61 | ## Are You a Blogger? 62 | > [!NOTE] 63 | > We are more than happy for you to try and review our product on the internet. Contact our team for more information. We would be pleased to provide you further details about our product. 64 | 65 | - Mail us: **press@openjourneybot.com** 66 | 67 | # 68 | 69 | ## Discord Server 70 |
71 | 72 | ## Installation 73 | > [!WARNING] 74 | > First Make sure you have `Node v18+` or higher version to run the bot 75 | 76 | `1` Clone the repository 77 | 78 | ### GitHub 79 | ```sh 80 | git clone https://github.com/sandarutharuneth/midjourney-bot 81 | ``` 82 | 83 | `2` Fill your Token and other dependencies at [config.json](https://github.com/sandarutharuneth/midjourney-bot/blob/master/src/config/config.json) 84 | ```json 85 | { 86 | "TOKEN": "BOT TOKEN", 87 | "API": "YOUR REPLICATE API KEY", 88 | "CLIENTID": "YOUR BOT ID", 89 | "OWNER": ["YOUR ID"] 90 | } 91 | ``` 92 | 93 | `3` Get your Replicate API 94 | - Visit [Replicate](https://replicate.com) and create an account 95 | - Get API token [API Section](https://replicate.com/account/api-tokens) 96 | - Paste the Key on `config.json` 97 | 98 | `4` Allow all Intents 99 | - Visit Discord devloper portal and turn on all the intents 100 | 101 | `5` Install dependencies 102 | ```sh 103 | npm i 104 | ``` 105 | 106 | `6` Start the bot 107 | ```sh 108 | node . 109 | ``` 110 | 111 | ## Run 112 | On your discord server use slash command `/imagine` to get results 113 | Ex: `/imagine: anime landscape, genshin impact style` 114 | 115 | If you enjoy our work, please consider giving a start to the repository ⭐️ 116 | # 117 | 118 | ## Usage 119 | ### Personal Usage 120 | You can use our code without any credits for your personal project 121 | 122 | ### Public Usage 123 | > [!NOTE] 124 | > You must keep the credits and must mention this repository or links to code authors [@sandarutharuneth](https://github.com/sandarutharuneth), [@Dex-404](https://github.com/Dex-404) 125 | Or we will issue a DMCA for the code. Please respect the code authours and keep the credits. 126 | 127 |
©️ Openjourney Neural Labs
128 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | require('./src/console/watermark') 2 | const { Client, Partials, Collection } = require('discord.js'); 3 | const colors = require('colors'); 4 | const config = require('./src/config/config.json') 5 | 6 | const client = new Client({ 7 | intents: [ 8 | "Guilds", 9 | "GuildMessages", 10 | "GuildPresences", 11 | "GuildMessageReactions", 12 | "DirectMessages", 13 | "MessageContent", 14 | "GuildVoiceStates" 15 | ], 16 | partials: [ 17 | Partials.Channel, 18 | Partials.Message, 19 | Partials.User, 20 | Partials.GuildMember, 21 | Partials.Reaction 22 | ] 23 | }) 24 | 25 | if (!config.TOKEN) { 26 | console.log("[WARN] Token for discord bot is required! put your token in config file".yellow.bold + "\n") 27 | return process.exit(); 28 | }; 29 | 30 | client.commands = new Collection() 31 | client.events = new Collection() 32 | client.slash = new Collection() 33 | client.aliases = new Collection() 34 | client.config = require("./src/config/config.json") 35 | 36 | module.exports = client; 37 | 38 | ["event", "slash"].forEach(file => { 39 | require(`./src/handlers/${file}`)(client); 40 | }); 41 | 42 | client.login(config.TOKEN) 43 | .catch((err) => { 44 | console.log("[CRUSH] Something went wrong while connecting to your bot" + "\n"); 45 | console.log("[CRUSH] Error from DiscordAPI :" + err); 46 | process.exit(); 47 | }) 48 | 49 | process.on("unhandledRejection", async (err) => { 50 | console.log(`[ANTI - CRUSH] Unhandled Rejection : ${err}`.red.bold) 51 | }) 52 | 53 | 54 | // ©️ Copyright Project Razer LLC 2023 All Rights Reserved. 55 | // Credits: @sandarutharuneth, @oelin 56 | // License: MIT 57 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "midjourney-bot", 3 | "version": "1.0.5", 4 | "description": "An opensource Discord AI bot made to generate images using Replicate API for free", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node .", 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/sandarutharuneth/midjourney-bot.git" 13 | }, 14 | "keywords": [], 15 | "author": "sandarutharuneth", 16 | "license": "BSD-3-Clause", 17 | "bugs": { 18 | "url": "https://github.com/sandarutharuneth/midjourney-bot/issues" 19 | }, 20 | "homepage": "https://github.com/sandarutharuneth/midjourney-bot#readme", 21 | "dependencies": { 22 | "colors": "^1.4.0", 23 | "common-tags": "^1.8.2", 24 | "discord.js": "^14.6.0", 25 | "log": "^6.3.1", 26 | "replicate": "^0.11.1" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/config/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "TOKEN": "YOUR TOKEN", 3 | "API": "YOUR REPLICATE API KEY", 4 | "CLIENTID": "YOUR BOT ID", 5 | "OWNER": ["YOUR ID"] 6 | } -------------------------------------------------------------------------------- /src/console/watermark.js: -------------------------------------------------------------------------------- 1 | const { stripIndent } = require("common-tags"); 2 | const colors = require('colors') 3 | 4 | console.log(stripIndent` 5 | -------------------------------------------------- 6 | █▀█ █▀█ █▀█ ░░█ █▀▀ █▀▀ ▀█▀ █▀█ ▄▀█ ▀█ █▀▀ █▀█ 7 | █▀▀ █▀▄ █▄█ █▄█ ██▄ █▄▄ ░█░ █▀▄ █▀█ █▄ ██▄ █▀▄ 8 | -------------------------------------------------- 9 | `.red.bold) 10 | 11 | 12 | // ©️ Copyright Project Razer LLC 2023 All Rights Reserved. 13 | // Credits: @sandarutharuneth, @oelin 14 | // License: MIT 15 | -------------------------------------------------------------------------------- /src/events/client/interactionCreate.js: -------------------------------------------------------------------------------- 1 | const { PermissionsBitField, EmbedBuilder } = require('discord.js'); 2 | const client = require('../../../index'); 3 | 4 | module.exports = { 5 | name: "interactionCreate" 6 | }; 7 | 8 | client.on("interactionCreate", async interaction => { 9 | if (!interaction.isChatInputCommand()) return; 10 | if (!interaction.type == 2) return; 11 | 12 | const command = client.slash.get(interaction.commandName); 13 | 14 | if (!command) return; 15 | 16 | try { 17 | if (command.ownerOnly) { 18 | if (!config.OWNER.includes(interaction.member.id)) { 19 | interaction.reply({ 20 | content: `**${interaction.member}** You can't access owner commands`, 21 | ephemeral: true 22 | }) 23 | return false; 24 | } 25 | } 26 | 27 | if (command.userPermissions) { 28 | if (!interaction.member.permissions.has(PermissionsBitField.resolve(command.userPermissions || []))) return interaction.reply({ 29 | content: `${interaction.member} You don't have the required permissions to use this command -> \`${command.userPermissions || []}\``, 30 | ephemeral: true 31 | }) 32 | return false; 33 | } 34 | 35 | if (command.botPermissions) { 36 | if (!interaction.guild.members.cache.get(client.user.id).permissions.has(PermissionsBitField.resolve(command.botPermissions || []))) return interaction.reply({ 37 | content: `${interaction.member} I don't have the required permissions to use this command -> \`${command.botPermissions || []}\``, 38 | ephemeral: true 39 | }) 40 | return false; 41 | } 42 | 43 | await command.run(client, interaction, interaction.options) 44 | } catch (err) { 45 | console.log(err); 46 | } 47 | }) 48 | 49 | // ©️ Copyright Project Razer LLC 2023 All Rights Reserved. 50 | // Credits: @sandarutharuneth, @oelin 51 | // License: MIT 52 | -------------------------------------------------------------------------------- /src/events/client/ready.js: -------------------------------------------------------------------------------- 1 | const client = require('../../../index'); 2 | const colors = require('colors'); 3 | 4 | module.exports = { 5 | name: "ready" 6 | }; 7 | 8 | client.once('ready', async () => { 9 | console.log("----------------------------------------".white); 10 | console.log(`[READY] ${client.user.tag} is up and ready to go.`.bold) 11 | console.log("----------------------------------------".white); 12 | }) 13 | 14 | 15 | // ©️ Copyright Project Razer LLC 2023 All Rights Reserved. 16 | // Credits: @sandarutharuneth, @oelin 17 | // License: MIT 18 | -------------------------------------------------------------------------------- /src/handlers/event.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const colors = require('colors'); 3 | 4 | module.exports = (client) => { 5 | console.log("----------------------------------------".yellow); 6 | 7 | fs.readdirSync('./src/events/').forEach(dir => { 8 | const commands = fs.readdirSync(`./src/events/${dir}`).filter(file => file.endsWith('.js')); 9 | for (let file of commands) { 10 | let pull = require(`../events/${dir}/${file}`); 11 | if (pull.name) { 12 | client.events.set(pull.name, pull); 13 | console.log(`[HANDLER - EVENTS] Loaded a file : ${pull.name}`.green) 14 | } else { 15 | console.log("\n" + "----------------------------------------".red) 16 | console.log(`[HANDLER - EVENTS] Couldn't load the file ${file}, missing name or aliases`.red.bold) 17 | console.log("----------------------------------------".red) 18 | continue; 19 | } 20 | } 21 | }) 22 | console.log("----------------------------------------".yellow); 23 | } 24 | 25 | 26 | // ©️ Copyright Project Razer LLC 2023 All Rights Reserved. 27 | // Credits: @sandarutharuneth, @oelin 28 | // License: MIT 29 | -------------------------------------------------------------------------------- /src/handlers/slash.js: -------------------------------------------------------------------------------- 1 | const client = require('../../index'); 2 | const config = require("../config/config.json"); 3 | const { REST, Routes } = require('discord.js'); 4 | const fs = require('fs') 5 | const colors = require('colors'); 6 | 7 | module.exports = async () => { 8 | console.log("----------------------------------------".yellow); 9 | 10 | const slash = []; 11 | 12 | fs.readdirSync('./src/slashCommands/').forEach(dir => { 13 | const commands = fs.readdirSync(`./src/slashCommands/${dir}`).filter(file => file.endsWith('.js')); 14 | for (let file of commands) { 15 | let pull = require(`../slashCommands/${dir}/${file}`); 16 | 17 | if (pull.name) { 18 | slash.push(pull) 19 | client.slash.set(pull.name, pull); 20 | console.log(`[HANDLER - SLASH] Loaded a file : ${pull.name}`.green); 21 | 22 | } else { 23 | console.log(`[HANDLER - SLASH] Couldn't load the file ${file}, missing module name value.`.red) 24 | continue; 25 | } 26 | } 27 | }); 28 | 29 | if (!config.CLIENTID) { 30 | console.log("[CRUSH] You have to provide your client ID in config file".red + "\n"); 31 | return process.exit() 32 | }; 33 | 34 | const rest = new REST({ version: '10' }).setToken(config.TOKEN); 35 | 36 | await rest.put( 37 | Routes.applicationCommands(config.CLIENTID), 38 | { body: slash } 39 | ).then(() => { 40 | console.log("----------------------------------------".magenta); 41 | console.log(`[HANDLER - SLASH] Slash commands has been registered successfully to all the guilds`.magenta.bold); 42 | console.log("----------------------------------------".magenta); 43 | }) 44 | } 45 | 46 | 47 | // ©️ Copyright Project Razer LLC 2023 All Rights Reserved. 48 | // Credits: @sandarutharuneth, @oelin 49 | // License: MIT 50 | -------------------------------------------------------------------------------- /src/slashCommands/information/imagine.js: -------------------------------------------------------------------------------- 1 | const { SlashCommandBuilder, EmbedBuilder, ApplicationCommandOptionType, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js") 2 | const config = require("../../config/config.json") 3 | 4 | 5 | module.exports = { 6 | name: "imagine", 7 | description: "Generate art in your dreams!", 8 | options: [ 9 | { 10 | name: "prompt", 11 | description: "Your prompt to generate the art", 12 | type: ApplicationCommandOptionType.String, 13 | required: true 14 | } 15 | ], 16 | run: async (client, interaction, args) => { 17 | await interaction.deferReply() 18 | const prompt = interaction.options.getString("prompt") 19 | const Replicate = require('replicate') 20 | //const Replicate = (await import("replicate")).default 21 | 22 | const replicate = new Replicate({ 23 | auth: config.API, 24 | }); 25 | 26 | const output = await replicate.run("stability-ai/stable-diffusion:db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf", { 27 | input: { 28 | prompt: prompt 29 | } 30 | }) 31 | 32 | console.log() 33 | 34 | const row = new ActionRowBuilder() 35 | .addComponents( 36 | new ButtonBuilder() 37 | .setLabel(`Download`) 38 | .setStyle(ButtonStyle.Link) 39 | .setURL(`${output}`), 40 | new ButtonBuilder() 41 | .setLabel(`Support Us`) 42 | .setStyle(ButtonStyle.Link) 43 | .setURL('https://paypal.me/officialrazer')) 44 | 45 | const embed = new EmbedBuilder() 46 | .setTitle("**Your Prompt:**") 47 | .setDescription(`**${prompt}**`) 48 | .setImage(`${output}`) 49 | .setColor('#2f3136') 50 | .setFooter({ text: `Requested by: ${interaction.user.username} | ©️ Project Razer `, 51 | iconURL: interaction.user.displayAvatarURL({ dynamic: true }), 52 | }) 53 | 54 | await interaction.editReply({ embeds: [embed], components: [row] }) 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/slashCommands/information/ping.js: -------------------------------------------------------------------------------- 1 | const { EmbedBuilder } = require('discord.js'); 2 | 3 | module.exports = { 4 | name: 'ping', 5 | description: '🏓Check my ping!', 6 | run: async (client, interaction) => { 7 | let pembed = new EmbedBuilder() 8 | .setTitle("Pong!") 9 | .setColor('#2F3136') 10 | .setThumbnail('https://i.imgur.com/Cbs7ljR.png') 11 | .addFields({name: '**Latency**', value: `\`\`\`ini\n[ ${Date.now() - interaction.createdTimestamp}ms ]\n\`\`\``, inline: true}, 12 | {name: '**API Latency**', value: `\`\`\`ini\n[ ${Math.round(client.ws.ping)}ms ]\n\`\`\``, inline: true}) 13 | .setTimestamp() 14 | .setFooter({ 15 | text: `©️ Project Razer`, 16 | iconURL: ('https://i.imgur.com/Cbs7ljR.png') 17 | }) 18 | interaction.reply({ 19 | embeds: [pembed] 20 | }); 21 | }, 22 | }; 23 | 24 | 25 | 26 | // ©️ Copyright Project Razer LLC 2023 All Rights Reserved. 27 | // Credits: @sandarutharuneth, @oelin 28 | // License: MIT 29 | -------------------------------------------------------------------------------- /src/slashCommands/information/prompts.js: -------------------------------------------------------------------------------- 1 | const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); 2 | 3 | module.exports = { 4 | name: 'prompts', 5 | description: 'some helpful prompts for you to get started', 6 | run: async (client, interaction) => { 7 | 8 | const row = new ActionRowBuilder() 9 | .addComponents( 10 | new ButtonBuilder() 11 | .setLabel("Visit for more Prompts") 12 | .setStyle(ButtonStyle.Link) 13 | .setURL("https://prompthero.com/openjourney-prompts") 14 | .setEmoji('1089552783339954246'),) 15 | 16 | let pembed = new EmbedBuilder() 17 | .setTitle("Here are some trending prompts") 18 | .setColor('#2F3136') 19 | .setThumbnail('https://i.imgur.com/Cbs7ljR.png') 20 | .setDescription(` 21 | <:next:1000472400049209385> mdjrny-v4 style, magic spell book sitting on a table in the catacombs, hypermaximalist, insanely detailed and intricate, octane render, unreal engine, 8k, by greg rutkowski and Peter Mohrbacher and magali villeneuve\n\n\ 22 | <:next:1000472400049209385> mdjrny-v4 style, photo of a gorgeous blonde female in the style of stefan kostic, realistic, half body shot, sharp focus, 8 k high definition, insanely detailed, intricate, elegant, art by stanley lau and artgerm, extreme blur cherry blossoms background\n\n\ 23 | <:next:1000472400049209385> mdjrny-v4 style, japanese style shrine on top of a misty mountain overgrown, hyper realistic, lush gnarly plants, 8 k, denoised, by greg rutkowski, tom bagshaw, james gurney cinematic lighting\n\n\ 24 | <:next:1000472400049209385> mdjrny-v4 style, valley, fairytale treehouse village covered,, matte painting, highly detailed, dynamic lighting, cinematic, realism, realistic, photo real, sunset,detailed, high contrast, denoised, centered, michael whelan`) 25 | .setFooter({ 26 | text: `©️ Project Razer`, 27 | iconURL: ('https://i.imgur.com/Cbs7ljR.png') 28 | }) 29 | interaction.reply({ 30 | embeds: [pembed], components: [row] }); 31 | }, 32 | }; 33 | --------------------------------------------------------------------------------