this post was submitted on 22 Jun 2023
2 points (100.0% liked)

vintech

70 readers
1 users here now

This is a place for people residing in Vietnam to discuss technology -- because sometimes the local optimum for a problem is a little bit different here.

No ads, political content, NSFW, and so on. Be helpful, kind, and patient.

founded 1 year ago
MODERATORS
 

I was hoping that I could leave open registration here for a few days, but apparently there are a ton of lemmy bots. I got 18k within 2 days.

So I logged in to my server, and did this:

  1. Run docker ps to get the name of the container running postgres.
  2. docker exec -it /bin/bash
  3. psql -h localhost -p 5432 -U lemmy -d lemmy
  4. The bot users in my case were all users where id>=3 in my case.
  5. So I ran DELETE FROM TABLE local_user where id>=3
  6. Done

To anyone else with this problem, this approach will only work if the bots are within a certain range of user ids. Still, it worked in my very simple case so I'll leave it here.

User registration is no longer open. My VPS provider tends to block outbound 485, so until I sort that out, user registration is temporarily closed.

top 1 comments
sorted by: hot top controversial new old
[–] Saigonauticon@voltage.vn 1 points 1 year ago* (last edited 1 year ago)

That removes the users, but to update the instance stats there's one more step (thank you @sunaurus@lemm.ee):

  1. Log in to postgres as before
  2. Execute:

update site_aggregates

set users = (select count(*) from local_user)

where site_id = 1;

This will force an update to the instance stats, so the bots that you removed won't show up as users. This is important as people may not wish to federate or interact with instances that appear to mostly consist of bots.