Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Inside of slash command:
- u1 = disnake.ui.Button(custom_id='u1', label='U1', style=disnake.ButtonStyle.blurple, row=0)
- u2 = disnake.ui.Button(custom_id='u2', label='U2', style=disnake.ButtonStyle.blurple, row=0)
- u3 = disnake.ui.Button(custom_id='u3', label='U3', style=disnake.ButtonStyle.blurple, row=0)
- u4 = disnake.ui.Button(custom_id='u4', label='U4', style=disnake.ButtonStyle.blurple, row=0)
- u5 = disnake.ui.Button(custom_id='u5', label='U5', style=disnake.ButtonStyle.blurple, row=1)
- u6 = disnake.ui.Button(custom_id='u6', label='U6', style=disnake.ButtonStyle.blurple, row=1)
- u7 = disnake.ui.Button(custom_id='u7', label='U7', style=disnake.ButtonStyle.blurple, row=1)
- u8 = disnake.ui.Button(custom_id='u8', label='U8', style=disnake.ButtonStyle.blurple, row=1)
- u1.callback = u1callback(codeid)
- u2.callback = u2callback(codeid)
- u3.callback = u3callback(codeid)
- u4.callback = u4callback(codeid)
- u5.callback = u5callback(codeid)
- u6.callback = u6callback(codeid)
- u7.callback = u7callback(codeid)
- u8.callback = u8callback(codeid)
- view = disnake.ui.View(timeout=None)
- view.add_item(u1)
- view.add_item(u2)
- view.add_item(u3)
- view.add_item(u4)
- view.add_item(u5)
- view.add_item(u6)
- view.add_item(u7)
- view.add_item(u8)
- outside of slash command:
- async def u1callback(codeid):
- await upscale(disnake.ApplicationCommandInteraction, number=1, code=codeid)
- async def u2callback(codeid):
- await upscale(disnake.ApplicationCommandInteraction, number=2, code=codeid)
- async def u3callback(codeid):
- await upscale(disnake.ApplicationCommandInteraction, number=3, code=codeid)
- async def u4callback(codeid):
- await upscale(disnake.ApplicationCommandInteraction, number=4, code=codeid)
- async def u5callback(codeid):
- await upscale(disnake.ApplicationCommandInteraction, number=5, code=codeid)
- async def u6callback(codeid):
- await upscale(disnake.ApplicationCommandInteraction, number=6, code=codeid)
- async def u7callback(codeid):
- await upscale(disnake.ApplicationCommandInteraction, number=7, code=codeid)
- async def u8callback(codeid):
- await upscale(disnake.ApplicationCommandInteraction, number=8, code=codeid)
- other slash command
- @bot.slash_command(description='Generates images using Stable Horde!')
- async def generate(
- inter: disnake.ApplicationCommandInteraction,
- prompt: str = commands.Param(description='What the AI-generated image should be of.'),
- neg_prompt: str = commands.Param(default = '2D, grid, text', description='What the AI image model should avoid. Default: \'2D, grid, text\''),
- upscalers: str = commands.Param(choices=settings.processor_list, default='GFPGAN', description='Which Post-Processing to use for the images. Default: GFPGAN'),
- model: str = commands.Param(default=settings.default_model,choices=settings.model_list, description='Which model to generate the image with. Default: ' + str(settings.default_model)),
- cfg_scale: Optional[float] = commands.Param(default=8, le=30, ge=-40, description='How much the image should look like your prompt. Default: 8'),
- #imageurl: str = commands.Param(name = 'init_image', default = None, description='Initial image for img2img.'),
- width: int = commands.Param(default = settings.default_width, le=1024, ge=64, description='Width of the final image. Default: ' + str(settings.default_width)),
- height: int = commands.Param(default = settings.default_height, le=1024, ge=64, description='Height of the final image. Default: ' + str(settings.default_height)),
- sampler: str = commands.Param(default = settings.default_sampler, description = 'ADVANCED: Which stable diffusion sampler to use. Default: ' + settings.default_sampler, choices=settings.sampler_list),
- steps: int = commands.Param(default=settings.default_steps, le=50, ge=1, description='Greater: Higher Image Quality but takes longer. Default: ' + str(settings.default_steps)),
- seed: int = commands.Param(default=-1, description='Seed for the image.')
- ):
- error:
- ```sh
- Ignoring exception in view <View timeout=None children=8> for item <Button style=<ButtonStyle.primary: 1> url=None disabled=False label='U1' emoji=None row=0>:
- Traceback (most recent call last):
- File "/Users/oriontomasi/opt/anaconda3/lib/python3.9/site-packages/disnake/ui/view.py", line 385, in _scheduled_task
- await item.callback(interaction)
- TypeError: 'coroutine' object is not callable
- ```
Advertisement
Add Comment
Please, Sign In to add comment