platypus.py 751 B

1234567891011121314151617
  1. import platform
  2. import socket
  3. from util import commands
  4. import version
  5. @commands(".platform")
  6. def platform_info(bot, message, channel):
  7. unique_modules = list()
  8. # because the bot doesn't necessarily hold onto modules themselves, just events, iterate over the events, and then all their subscribers.
  9. # then unique off those.
  10. for ev in bot.events_list:
  11. for x in ev.subscribers:
  12. if type(x).__name__ not in unique_modules: # get the name of the class the instance comes from
  13. unique_modules.append(type(x).__name__)
  14. bot.say(channel, "I'm " + bot.NICK + " v. " + version.__version__ + ", running on python " + platform.python_version() + ", on " + socket.getfqdn() + ". I have " + str(len(unique_modules)) + " modules loaded.")