Advertisement
sharch

E-Pênis script para HexChat (Linux & Windows)

Jan 6th, 2016
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.83 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. #   epenis.py
  5. #
  6. #       Copyright 2011 sharch <sharch@thegame.com>
  7. #      
  8. #       This program is free software; you can redistribute it and/or modify
  9. #       it under the terms of the GNU General Public License as published by
  10. #       the Free Software Foundation; either version 2 of the License, or
  11. #       (at your option) any later version.
  12. #      
  13. #       This program is distributed in the hope that it will be useful,
  14. #       but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. #       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. #       GNU General Public License for more details.
  17. #      
  18. #       You should have received a copy of the GNU General Public License
  19. #       along with this program; if not, write to the Free Software
  20. #       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  21. #       MA 02110-1301, USA.
  22. #      
  23. #
  24. #   Displays your e-penis size based on system uptime. Usage: /epenis
  25.  
  26. import hexchat
  27. import math
  28. import os
  29.  
  30. __module_name__ = "epenis.py"
  31. __module_version__ = "0.7"
  32. __module_description__ = "Exibe o tamanho do seu e-penis baseado no uptime do sistema"
  33. __module_author__ = "sharch"
  34.  
  35.  
  36. try:
  37.     # So many broken ctypeses out there.
  38.     import ctypes
  39.     import struct
  40. except ImportError:
  41.     ctypes = None
  42.  
  43. hexchatdir = hexchat.get_info('configdir')
  44. epenisdb = os.path.join(hexchatdir, 'addons', 'epenis.db')
  45.      
  46. if (os.name != 'posix') and (os.name != 'nt'):
  47.     do_alert("Operating System not supported. \002%s\002 will not work" % __module_name__)
  48.  
  49.  
  50. def uptime_windows():
  51.     """
  52.     Returns uptime in seconds or None, on Windows. Warning: may return
  53.     incorrect answers after 49.7 days on versions older than Vista.
  54.     """
  55.     if hasattr(ctypes, 'windll') and hasattr(ctypes.windll, 'kernel32'):
  56.         lib = ctypes.windll.kernel32
  57.             # Windows CE uses the cdecl calling convention.
  58.     else:
  59.         try:
  60.             lib = ctypes.CDLL('coredll.lib')
  61.         except (AttributeError, OSError):
  62.             return None
  63.    
  64.     if hasattr(lib, 'GetTickCount64'):
  65.         # Vista/Server 2008 or later.
  66.         lib.GetTickCount64.restype = ctypes.c_uint64
  67.         return lib.GetTickCount64() / 1000.
  68.     if hasattr(lib, 'GetTickCount'):
  69.         # WinCE and Win2k or later; gives wrong answers after 49.7 days.
  70.         lib.GetTickCount.restype = ctypes.c_uint32
  71.         return lib.GetTickCount() / 1000.
  72.     return None
  73.  
  74. def uptime_linux():
  75.     try:
  76.         with open('/proc/uptime', 'r') as f:
  77.             return float(f.readline().split()[0])
  78.     except:
  79.         pass
  80.  
  81. def get_erection():
  82.     global epenisdb
  83.    
  84.     try:
  85.         with open(epenisdb) as db:
  86.             f = db.read()
  87.             if f:
  88.                 return float(f)
  89.             else:
  90.                 return 0
  91.             db.close()
  92.     except IOError:
  93.         save_erection('0')
  94.         return 0
  95.  
  96. def save_erection(value):
  97.     global epenisdb
  98.    
  99.     db = open(epenisdb, 'w')
  100.     db.write(str(value))
  101.     db.close()
  102.        
  103. def epenis_callback(word, word_eol, userdata):
  104.     if os.name == 'posix':
  105.         uptime = uptime_linux()
  106.     if os.name == 'nt':
  107.         uptime = uptime_windows()
  108.        
  109.     size = round((math.sqrt((0.0005 * uptime)) * 2.540),2)
  110.     penis = '=' * int(size * 0.6)
  111.     sperm = '~°'
  112.    
  113.     if get_erection() > size:
  114.         record = 'Minha maior ereção foi de ' + str(get_erection()).replace('.',',') + 'cm'
  115.     else:
  116.         record = 'Esta é minha maior ereção até o momento'
  117.         save_erection(size)
  118.    
  119.     if int(size) > 10:
  120.         sperm *= (int(size / 10))
  121.    
  122.     hexchat.command('SAY Baseado no uptime do sistema, meu e-pênis mede \002' + str(size).replace('.',',') + '\002 cm. (' + record +') 8' + penis + 'D ' + sperm)
  123.     return hexchat.EAT_ALL
  124.  
  125. def do_alert(alert_string):
  126.     message = "\002【{0}】\002{1}".format(__module_name__, alert_string)
  127.     hexchat.emit_print("Server Error", message)
  128.  
  129. hexchat.hook_command('epenis', epenis_callback, help='epenis - Exibe o tamanho do seu e-penis baseado no uptime do sistema')
  130.  
  131. do_alert("module loaded")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement