Advertisement
zcomv3

Script para HexChat que envia Consejos al Canal cuando alguien escribe .consejos Python

Jul 30th, 2022 (edited)
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. import hexchat
  2. import random
  3.  
  4.  
  5. __module_name__ = "Escribe-Consejos"
  6. __module_author__ = "Raull77 Zcom"
  7. __module_version__ = "0.1"
  8. __module_description__ = "Responde con un consejos cunado se escribe la palabra .consejos"
  9.  
  10.  
  11.  
  12. def frase_aleatoria(fichero):
  13.     with open(fichero,'r',encoding='UTF-8') as f:
  14.         todas_las_frases = f.read().splitlines()
  15.         frase_elegida = random.choice(todas_las_frases)
  16.         hexchat.command("SAY " +  frase_elegida)
  17.  
  18.  
  19. def event_cb(word, word_eol, userdata):
  20.    
  21.     if word[1] == '.consejos':
  22.         frase_aleatoria('/home/k/.config/hexchat/addons/frases.txt')
  23.    
  24.    
  25.     return hexchat.EAT_NONE
  26.  
  27.  
  28. hexchat.hook_print("Channel Message", event_cb)
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement