Skip to content

Commit

Permalink
Create imagegen.py
Browse files Browse the repository at this point in the history
  • Loading branch information
doraemon890 authored May 13, 2024
1 parent 802da04 commit 40687b5
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions ANNIEMUSIC/plugins/tools/imagegen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from pyrogram import filters
from pyrogram.types import Message
from pyrogram.types import InputMediaPhoto
from MukeshAPI import api
from pyrogram.enums import ChatAction,ParseMode
from ANNIEMUSIC import app

@app.on_message(filters.command("imagine"))
async def imagine_(b, message: Message):
if message.reply_to_message:
text = message.reply_to_message.text
else:

text =message.text.split(None, 1)[1]
Jarvis=await message.reply_text( "`Please wait...\n\nGenerating image .....`")
try:
await b.send_chat_action(message.chat.id, ChatAction.UPLOAD_PHOTO)
x=api.ai_image(text)
with open("mukesh.jpg", 'wb') as f:
f.write(x)
caption = f"""
💘sᴜᴄᴇssғᴜʟʟʏ ɢᴇɴᴇʀᴀᴛᴇᴅ : {text}
✨ɢᴇɴᴇʀᴀᴛᴇᴅ ʙʏ : @Annie_Music_Robot
🥀ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ : {message.from_user.mention}
"""
await Jarvis.delete()
await message.reply_photo("mukesh.jpg",caption=caption,quote=True)
except Exception as e:
await Jarvis.edit_text(f"error {e}")


__mod_name__ = "Aɪ ɪᴍᴀɢᴇ"
__help__ = """
➻ /imagine : ɢᴇɴᴇʀᴀᴛᴇ Aɪ ɪᴍᴀɢᴇ ғʀᴏᴍ ᴛᴇxᴛ
"""

0 comments on commit 40687b5

Please sign in to comment.