#hikari-miru.view not working on vm

1 messages ยท Page 1 of 1 (latest)

thin wedge
#

uhhh so this is my code, I had to change a few names in the slash commands cus' the purpose of that command was um... a bit embarrassing.

import hikari
import lightbulb
import miru

bot = lightbulb.BotApp(token="nope stoopid", prefix="!")


class DiceView(miru.View):
    @miru.button(label="yes", emoji="๐Ÿ‘", style=hikari.ButtonStyle.SUCCESS)
    async def btn_yes(self, button: miru.Button, ctx: miru.ViewContext) -> None:
        await bot.rest.add_role_to_member(user=ctx.author, guild=ctx.guild_id, role=1111137057985789962)
        await ctx.edit_response("You have been given a basement keycard.", components=[])
        self.stop()

    @miru.button(label="no", emoji="๐Ÿ‘Ž", style=hikari.ButtonStyle.DANGER)
    async def btn_no(self, button: miru.Button, ctx: miru.ViewContext) -> None:
        await ctx.edit_response("Very well.", components=[])
        self.stop()


miru.install(bot)


@bot.command
@lightbulb.command("basement", "Oho, a secret?")
@lightbulb.implements(lightbulb.SlashCommand)
async def secret_stuff(ctx: lightbulb.Context, event=None) -> None:
    """Gives user access to stuff"""

    if 1111137057985789962 in ctx.member.role_ids:
        await ctx.respond("I believe you already have a basement keycard.")
    else:
        view = DiceView(timeout=30)
        message = await ctx.respond("Ah, I see you wish to access the basement. Be warned, access to the basement is scary",
                                    components=view.build(), flags=hikari.MessageFlag.EPHEMERAL)
        message = await message
        await view.start(message)
        await view.wait()
        print("All done.")


@bot.command
@lightbulb.option("message", "message to write", type=str)
@lightbulb.add_checks(lightbulb.checks.has_roles(1087936969297891388, 1088248323816837181, mode=any))
@lightbulb.command("writemessagerobonal", "Makes bot write a message")
@lightbulb.implements(lightbulb.SlashCommand)
async def write_message(ctx: lightbulb.Context) -> None:
    message = ctx.options.message
    await bot.rest.create_message(ctx.channel_id, message)
    await ctx.respond("I have sent the message.", flags=hikari.MessageFlag.EPHEMERAL)


@bot.listen(lightbulb.CommandErrorEvent)
async def error_handler(event: lightbulb.CommandErrorEvent) -> None:
    # Send user a check failure message
    if isinstance(event.exception, lightbulb.errors.CheckFailure):
        await event.context.respond(event.exception, flags=hikari.MessageFlag.EPHEMERAL)
        return

    # Re-raise any other error since this function can't deal with it
    raise event.exception


bot.run(
    activity=hikari.Activity(name="with stuff", type=hikari.ActivityType.PLAYING),
    status=hikari.Status.ONLINE
)

Anyways, most of it's irrelevant, but I'm trying to host the bot on a google cloud vm, using debian. I've created a venv and am trying to run the code through that, but I keep encountering:

    class DiceView(miru.View):
                   ^^^^^^^^^
AttributeError: module 'miru' has no attribute 'View'```

so then I tried it on my own PC (which SHOULD also be using a venv maybe?), and the code runs fine there, but not on the VM so I'm absolutely lost.

```Package           Version
----------------- ------------
aiohttp           3.9.3
aiosignal         1.3.1
alluka            0.1.4
attrs             23.2.0
colorlog          6.8.2
frozenlist        1.4.1
greenlet          3.0.3
hikari            2.0.0.dev122
hikari-lightbulb  2.3.5
hikari-miru       4.0.0
idna              3.6
multidict         6.0.5
pip               23.0.1
setuptools        66.1.1
SQLAlchemy        2.0.25
typing_extensions 4.9.0
urwid             2.5.1
yarl              1.9.4```

There's the package list, it should be right. Thank you for the help in advance.
cobalt vortex
#

Reset the token please

thin wedge
#

what that

cobalt vortex
#

Basically your bot's password?

thin wedge
#

oh shoot

#

im dumb

cobalt vortex
#

You just showed it to everyone :p

hazy raven
#

treat your token like a username + password for the bot

#

once anyone have it, your bot can be controlled by them

thin wedge
#

yeah no it totally slipped my mind

cobalt vortex
#

Also, obligatory @proper marsh ping

proper marsh
#

this looks like an incorrect miru install to me

cobalt vortex
#

It's a miru view, you seem adept it fixing that

#

:p

proper marsh
#

miru defo has a View object

acoustic musk
#

Can confirm

proper marsh
#

do you maybe have a file named miru.py somewhere?

thin wedge
thin wedge
thin wedge
acoustic musk
#

maybe just double check if you activated the venv or not :p

thin wedge
#

it should be, because I couldn't install hikari directly through root
or something like that

acoustic musk
#

*side-note: I like how your profile colours are basically the same as mine, just inversed

thin wedge
#

neato

#

uhhh double checking, but is it still miru.install(bot) to initialize, or was that changed?

acoustic musk
#

yes

#

it's miru.install(bot)

thin wedge
#

ok apparently that doesn't exist either

acoustic musk
#

huh

#

try running python3 -m hikari-miru

#

or was it just miru MoaiChonk

thin wedge
#

apparently miru is something else, I had to specify

acoustic musk
#

Yeah it is python3 -m miru

thin wedge
#

uhhhh and No module named hikari-miru

proper marsh
acoustic musk
proper marsh
#

no it is not

acoustic musk
proper marsh
#

please stop giving incorrect advice

acoustic musk
#

๐Ÿ’€

proper marsh
#

in v4

thin wedge
#

ah I thought as much

acoustic musk
#

It's working for me???

proper marsh
#

because you're not using v4

acoustic musk
#

Lemme check what version I am on ๐Ÿ’€

proper marsh
#

either way miru.View wasn't removed in v4

#

so

acoustic musk
thin wedge
#

no it works

proper marsh
#

your installation is still incorrect

thin wedge
#

it was a faulty install

proper marsh
thin wedge
#

though now I dunno how to initialize miru, this code is a few months old

proper marsh
#

you know, like this whole banner stuff

acoustic musk
proper marsh
#

I dunno how you can miss this

#

it's literally in your face, downright annoying even

#

:p

#

either way

acoustic musk
proper marsh
#

2.0?

#

that's like

#

uhhhhh

#

2 years out of date?

#

at least 1.5

acoustic musk
#

hmm I am using 3.4 ๐Ÿ’€

proper marsh
#

either way

acoustic musk
proper marsh
#

I wonder why that literally redirects to the new docs

#

lmao

#

smort

acoustic musk
#

It doesn't for me cryingandshaking

#

I am not lying

thin wedge
proper marsh
proper marsh
#

a super-old branch

proper marsh
#

it's the feature/modals branch

#

which was made eons ago for modal support

#

it's 2.0 beta

#

I should delete it

acoustic musk
#

nah I feel like an entire building crumbled around me

thin wedge
acoustic musk
#

I was using v3.4 with v2 beta docs MoaiChonk

acoustic musk
proper marsh
#

yes it does

#

refresh your browser cache

real gyro
acoustic musk
#

brb

acoustic musk
proper marsh
#

I use RoboDanny for that

#

lol

#

anyways

thin wedge
#

eyyy I got it

proper marsh
#

I can't really fix google

thin wedge
#

thanks peoples, 'preciate it

proper marsh
#

I have the new docs linked on the github

#

and the old docs redirect to it

#

as in the old docs latest branch

acoustic musk
#

ye...

#

welp time to rewrite parts of the bot

proper marsh
#

although it seems like the new docs are gaining traction

#

mfw it is youtube

acoustic musk
proper marsh
#

anyways

#

that obsolete link should die fairly quickly now that it 404's

#

I hope

unreal briar