• Draconic NEO@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      9
      arrow-down
      2
      ·
      edit-2
      6 days ago

      There are indeed API calls for banning users from communities. They’re not accessible in Lemmy-UI, they make you do it from a comment or post there, but you can do it from anywhere.

      Here’s the API call you use to do it: https://[instance url]/api/v3/community/ban_user

      And the body data you need, as well as some auth data specific to your session or account login not included here: `{“community_id”:[community ID],“person_id”:[User ID],“ban”:true,“remove_data”:false,“reason”:“[Ban reason]”}

      You can get User ID from a DM with the person, and you can get community ID by editing your community settings and taking a look at the request in the network tab of your Browser Dev tools.

      You can execute one of these by opening dev tools, going to Network tab, editing and saving community settings, then hit edit and resend request. Change the type from SET to POST then replace the API URL with the one here, and replace the body of the request with the one here with the data appropriately filled out, and when you hit send, it’ll ban the user from the community.

      I highly recommend community mods use this technique to deal with known bad actors before they infiltrate your community. Obviously one can go overboard and use it too much, but there are plenty of times it’s best to stop them before they join your community rather than after.