Eldinnie · GitHub

As long as this PR is not accepted into Release 12 I have tricked around with something like this which is not beautiful but does the necessary change:

pretty_thread_names = True
prefix_programname = "YourProgramnameHere"
prefix_worker_thread = "Worker"
# theUpdater contains the telegram Updater Object
if pretty_thread_names:
    try:
        for t in theUpdater._Updater__threads:
          if 'dispatcher' in t.name:
            t.name = prefix_programname+' Dispatcher'
          if 'updater' in t.name:
            t.name = prefix_programname+' Updater'
        for t in theUpdater.dispatcher._Dispatcher__async_threads:
          *_, num = t.name.split('_')
          t.name = '{0} {1} {2}'.format(prefix_programname, prefix_worker_thread, num) if num.isnumeric() else num
    except:
        pass

Read the original on github.com ↗