#Non Persistent view, when called using persistent view doesn't respond ?

1 messages · Page 1 of 1 (latest)

clever thicket
#

I tried making a persistent view, therein, I added 2 buttons, one for creating a channel and the other for creating another temporary view that will not be persistent, which will be used to manage that channel, I am facing an issue here, that the button in the temporary view is not responding.

The one view above the "Admin Panel" is basically persistent.

    class CLOSE(miru.Button):
        def __init__(
            self, *, 
            style: t.Union[hikari.ButtonStyle, int] = hikari.ButtonStyle.PRIMARY, 
            label: t.Optional[str] = None, 
            disabled: bool = False, 
            custom_id: t.Optional[str] = "ADMIN_CLOSE", 
            url: t.Optional[str] = None, 
            emoji: t.Union[hikari.Emoji, str, None] = DEFAULT.async_label, 
            row: t.Optional[int] = None) -> None:
            super().__init__(style=style, label= label, disabled= disabled, custom_id= custom_id, url= url, emoji=emoji, row=row)
        async def callback(self, context: ViewContext) -> None:
            print("HELLO WORLD!")

This is the code, which represents that one button.

    class AdminPanel(miru.Button):
        def __init__(
            self, *,
            style: t.Union[hikari.ButtonStyle, int] = hikari.ButtonStyle.SECONDARY, 
            label: t.Optional[str] = "ADMIN",
            disabled: bool = False, 
            custom_id: t.Optional[str] = "TICKET_ADMIN", 
            url: t.Optional[str] = None, 
            emoji: t.Union[hikari.Emoji, str, None] = None, 
            row: t.Optional[int] = 1
            ) -> None:
            super().__init__(style=style,label=label, disabled=disabled, custom_id=custom_id,url=url, emoji=emoji, row=row)
        async def callback(self, ctx: ViewContext) -> None:
            view = AdminSystemTicket()
            view.add_item(ADMIN_BUTTONS.CLOSE())
            await ctx.respond(
                content="Admin Panel!",
                components=view,
                flags=hikari.MessageFlag.EPHEMERAL
            )

This is how I am calling it.

clever thicket
hasty girder
clever thicket
hasty girder
#

ah cause I don't see that in your code

clever thicket
#

catThink that is the reason this appeared

clever thicket
hasty girder
clever thicket
#

gere

clever thicket
#

the fact that nothing get's printed on the terminal makes it worse

hasty girder
#

you didn't start the view though catThink

#

hm wait gimme a sec

clever thicket
#
    class AdminPanel(miru.Button):
        def __init__(
            self, *,
            style: t.Union[hikari.ButtonStyle, int] = hikari.ButtonStyle.SECONDARY, 
            label: t.Optional[str] = "ADMIN",
            disabled: bool = False, 
            custom_id: t.Optional[str] = "TICKET_ADMIN", 
            url: t.Optional[str] = None, 
            emoji: t.Union[hikari.Emoji, str, None] = None, 
            row: t.Optional[int] = 1
            ) -> None:
            super().__init__(style=style,label=label, disabled=disabled, custom_id=custom_id,url=url, emoji=emoji, row=row)
        async def callback(self, ctx: ViewContext) -> None:
            view = AdminSystemTicket()
            view.add_item(ADMIN_BUTTONS.CLOSE())
            await view.start()
            await ctx.respond(
                content="Admin Panel!",
                components=view,
                flags=hikari.MessageFlag.EPHEMERAL
            )
#

this was my latest code

#

awkward I did

hasty girder
#

I feel like this isn't how persistent views work

clever thicket
#

I feel the same

#

but there should be a way

#

to do it right

#

like

#

I need a temp view

#

from a persistent view

#

catThink there should be something like that I am missing

hasty girder
#

do you have this bit?

#

wait

#

@clever thicket is red the persistent view?

hasty girder
#

yes okay

clever thicket
hasty girder
#

then blue is the response when you click "ADMIN", right?

clever thicket
#

yep

hasty girder
#

okay

#

you didn't start the view for the blue message

clever thicket
#

that's was it right ?

hasty girder
#

yes, but that's wrong

clever thicket
hasty girder
#
async def callback(self, ctx: ViewContext) -> None:
    view = AdminSystemTicket()
    view.add_item(ADMIN_BUTTONS.CLOSE())

    resp = await ctx.respond(
        content="Admin Panel!",
        components=view,
        flags=hikari.MessageFlag.EPHEMERAL
    )
    await view.start(resp)
clever thicket
#

catThink oh wait okay, I get it, Message is basically started

hasty girder
#

the blue view is not persistent, so you need to attach it to a message

clever thicket
#

catThink okay I get the point

#

let me test

#

Shrey_ilu that perfectly worked thank you Nova