@ -75,12 +75,21 @@ class Callbacks(object):
print ( event )
print ( event )
await self . bot . send_message ( self . client , room . room_id , " Hello World! " )
await self . bot . send_message ( self . client , room . room_id , " Hello World! " )
return
return
elif event . body . startswith ( ' !image ' ) :
elif event . body . startswith ( ' !image ' ) or event . body . startswith ( ' !image1 ' ) :
prompt = event . body . removeprefix ( ' !image ' ) . strip ( )
prompt = event . body . removeprefix ( ' !image ' ) . removeprefix ( ' !image1 ' ) . strip ( )
negative_prompt = " out of frame, (ugly:1.3), (fused fingers), (too many fingers), (bad anatomy:1.5), (watermark:1.5), (words), letters, untracked eyes, asymmetric eyes, floating head, (logo:1.5), (bad hands:1.3), (mangled hands:1.2), (missing hands), (missing arms), backward hands, floating jewelry, unattached jewelry, floating head, doubled head, unattached head, doubled head, head in body, (misshapen body:1.1), (badly fitted headwear:1.2), floating arms, (too many arms:1.5), limbs fused with body, (facial blemish:1.5), badly fitted clothes, imperfect eyes, untracked eyes, crossed eyes, hair growing from clothes, partial faces, hair not attached to head "
negative_prompt = " out of frame, (ugly:1.3), (fused fingers), (too many fingers), (bad anatomy:1.5), (watermark:1.5), (words), letters, untracked eyes, asymmetric eyes, floating head, (logo:1.5), (bad hands:1.3), (mangled hands:1.2), (missing hands), (missing arms), backward hands, floating jewelry, unattached jewelry, floating head, doubled head, unattached head, doubled head, head in body, (misshapen body:1.1), (badly fitted headwear:1.2), floating arms, (too many arms:1.5), limbs fused with body, (facial blemish:1.5), badly fitted clothes, imperfect eyes, untracked eyes, crossed eyes, hair growing from clothes, partial faces, hair not attached to head "
if len ( prompt ) == 0 :
if len ( prompt ) == 0 :
prompt = " a beautiful woman "
prompt = " a beautiful woman "
output = await ai . generate_image ( prompt , negative_prompt , self . bot . runpod_api_key )
output = await ai . generate_image ( prompt , negative_prompt , " https://api.runpod.ai/v1/sd-anything-v4/ " , self . bot . runpod_api_key )
for imagefile in output :
await self . bot . send_image ( self . client , room . room_id , imagefile )
return
elif event . body . startswith ( ' !image2 ' ) :
prompt = event . body . removeprefix ( ' !image2 ' ) . strip ( )
negative_prompt = " ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, disfigured, deformed, body out of frame, bad anatomy, watermark, signature, cut off, low contrast, underexposed, overexposed, bad art, beginner, amateur, distorted face "
if len ( prompt ) == 0 :
prompt = " a beautiful woman "
output = await ai . generate_image ( prompt , negative_prompt , " https://api.runpod.ai/v1/stable-diffusion-v1/ " , self . bot . runpod_api_key )
for imagefile in output :
for imagefile in output :
await self . bot . send_image ( self . client , room . room_id , imagefile )
await self . bot . send_image ( self . client , room . room_id , imagefile )
return
return
@ -357,4 +366,5 @@ async def main() -> None:
for bot in bots :
for bot in bots :
task = tg . create_task ( bot . client . sync_forever ( timeout = 30000 , full_state = True ) )
task = tg . create_task ( bot . client . sync_forever ( timeout = 30000 , full_state = True ) )
if __name__ == " __main__ " :
asyncio . get_event_loop ( ) . run_until_complete ( main ( ) )
asyncio . get_event_loop ( ) . run_until_complete ( main ( ) )