Probably they use heavily background jobs with Celery or Dask.
As far as I know, Discord’s backend is written in Elixir and Erlang, but I might be wrong.