#give user role when onboarding is complete

1 messages · Page 1 of 1 (latest)

quick mantle
#

i know i'm doing this wrong cuz there is no guild_flags is member but what would i replace it with? basically what im trying to do is make the bot give the user a role when they complete onboarding and then send a welcome message

@welcome.listener(hikari.MemberCreateEvent)
async def on_member_join_update(event: hikari.MemberCreateEvent) -> None:
    member = await event.app.rest.fetch_member(event.guild_id, event.user.id)

    if member.guild_flags & hikari.GuildMemberFlags.COMPLETED_ONBOARDING:
        role = 816858066330320897
        await member.add_role(role)
        await welcome.bot.rest.create_message(
            781422576660250637,  # Main server channel ID
            f"You made it, {member.mention}! Welcome to **Sage**, enjoy your stay 💚",
            user_mentions=True,
        )
inner flint
#

first of all, why are you fetching a member, on a member specific event...

Second of all, what do you mean it doesn't exist? If it doesn't exist, then how can you use it...?

quick mantle
#

oh the error message

#

it said 'Member' object has no attribute 'guild_flags'

inner flint
#

then it doesn't have them.

#

can you show me how you installed hikari?

quick mantle
#

pip install -U git+https://github.com/hikari-py/hikari.git

inner flint
#

Gimme until hikari's site loads, and I can give you a response

#

but I think hikari is dying because its ran on gh pages

#

guild_flags is defo there

#

sorry, I had to dig through the source code

#

can you do

pip uninstall hikari

and then run the command above?

#

start with a clean install.

quick mantle
#

found the problem

#

its cuz i didnt update in my vps

inner flint
#

haha

quick mantle
#

sometimes im dum

#

but thanks for the help

#

you made me realize

inner flint
#

idk know what your doing, but I switched to running my bots in docker containers

#

100000x easier, because it creates the container, with the same requirements you had in your dev setup.

quick mantle
#

ive never used docker before

#

but im willing to learn

inner flint
#

and im willing to help haha

quick mantle
#

can you please

inner flint
#

well, the main thing(s) you need, are two files

Dockerfile: This is how you setup your bot, and download requirements and stuff.

docker-compose.yml: This is how you actually tell the files how to run, and what environment variables to use.

#

gimme a minute to send you what I have for one of my bots.

quick mantle
#

appreciate it

inner flint
#
# syntax=docker/dockerfile:1
FROM python:3.12-alpine
WORKDIR /
RUN apk add --no-cache git
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "-Om", "chowa"]

So basically, what this does, is create a system, which python is used, sets the working directory to where you ran the command, copies your requirements, installs them, copies all your files, and then runs your bot.

(my bot is classified as a module, but you can change the last line to something like

CMD ["python", "-O", "main.py"]

if yours is not.

#
services:
  bot:
    container_name: cool bot
    restart: unless-stopped
    env_file: ".env"
    build: .

And this is the docker-compose.yml

#

outside of that, just call

docker compose up -d

and it will install, and run your bot.

#

you can stop it via

docker stop <container-name>

and delete it via

docker rm <container-name>
severe pendant
#

I cant get it running because of some fucking secure boot hypervisor problem

inner flint
#

don't use windows

#

also, just run it normally on your pc

severe pendant
# inner flint don't use windows

I prefer windows because all of my friends play primarily pc games in their free time and i want to continue playing games with them

inner flint
#

huh

#

I can literally play, all steam games, and non-steam games

#

#general

trim fog
quick mantle
#

maybe this is karma for getting a mac for a grad gift

#

but i need it for college guraspinning

finite cipher
#

What 🗿

#

I have a Mac and docker desktop works fine

severe pendant
#

there is one for the older intel chips and one version for apple silicon

#

and if you have apple silicon you should try installing rosetta first

trim fog
#

Just don't use docker in development

#

It's pointless

finite cipher
#

its pretty nice for running things like postgres or redis

severe pendant
#

Or for learning docker

quick mantle
#

i uninstalled it and then downloaded it again