Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- # Autor: Simon Kempf
- # Traducción al español: Dimichi Cháchara
- # IMPORTANTE : SkyGen no se hace responsable del uso del bot o el abuso del mismo.
- # Lee ésto si haces una modificación o editas el bot :
- # 1) Copia los comandos que has creado en la antigua versión a la nueva versión.
- # 2) Si has editado un comando, debes suprimir el código de la nueva versión cambiándolo al de la nueva versión.
- import socket, time, urllib, webbrowser #Imports, no modificar si no sabes Python.
- chan = "##dfsdfsdf"
- #Canal a donde irá el bot
- user_bot = "Cepita"
- #nick del bot
- ver = "Variante de LifeBot - Todos los derechos reservados Dimichi Cháchara y Simon Kempf"
- #Versión del bot
- host = "irc.freenode.net"
- #Red IRC
- port = 6667
- #Puerto de la red IRC
- trust = []
- #Los usuarios que pueden usar comandos especiales.
- #No modifiques ésto si no sabes Python.
- #Version de LifeBot :
- ver_LifeBot = "1.4"
- lang_LifeBot = "es"
- print(ver)
- #Contraseña :
- password = raw_input("123456")
- #Conexión de IRC :
- identify = True
- IRC = irc.freenode.net()
- IRC.connect((host, port))
- IRC.send("NICK %s\r\n" % user_bot)
- IRC.send("USER MasterBot %s bla :%s\r\n" % (host, user_bot))
- #Bucle de connnexion :
- while True:
- rep = IRC.recv(2048)
- rep2 = rep.split()
- print(rep)
- #
- try:
- if ":End of /MOTD command." in rep and identify == False:
- IRC.send("PRIVMSG NickServ :identify %s\r\n" % password)
- IRC.send("JOIN %s\r\n" % chan)
- identify = True
- #Respuesta al ping de la red IRC :
- if rep2[0] == "PING":
- IRC.send("PONG %s\r\n" % rep2[1])
- #Respuesta a las invitaciones del bot :
- if rep2[1] == "INVITE":
- IRC.send("JOIN %s\r\n" % rep2[3])
- except IndexError:
- rep2 = ["", "", "", "", "", "", "", "", "", ""]
- #
- user = rep2[0].split("!")
- user[0] = user[0].strip(":")
- trusted = user[0] in trust
- if rep2[1] == "PRIVMSG":
- try:
- if rep2[2].startswith("#") == False:
- rep2[2] = user[0]
- #Fin de la partie.
- #Début de la sintaxis.
- if rep2[3].lower() == ":!commandtest":
- IRC.send("PRIVMSG %s :%s\r\n" % (rep2[2], "Texte à envoyer."))
- #Fin de la sintaxis.
- #Sigue la sintaxis de arriba cuando quieras agregar un comando. ¿Necesitas ayuda? ¡Consulta en ##SkyGen!
- if rep2[3].lower() == ":!ban" and trusted: #Aquí, un comando que banea al usuario de un canal, on a une commande qui bannit l'utilisateur d'un chan
- try:
- IRC.send("MODE %s +b %s\r\n" % (rep2[4], rep2[5])) #Si escribes !ban ##machin bidule, el bot banea al usuario bidule del canal ##machin (el bot debe ser op del canal para que el comando funcione)
- except IndexError: #si on ne met pas le chan (exemple, si on tape !ban bidule)
- IRC.send("MODE %s +b %s\r\n" % (rep2[2], rep2[4])) #El bot banea al usuario del canal donde el comando se ejecuta (el bot debe ser op del canal para que el comando funcione)
- if rep2[3].lower() == ":!bing":
- IRC.send("PRIVMSG %s :%s\r\n" % (rep2[2], "http://www.bing.com/search?q=" + "+".join(rep2[4:])))
- if (rep2[3].lower() == ":!chanserv" or rep2[3].lower() == ":!cs") and trusted: #Comando que envía un mensaje a ChanServ.
- IRC.send("PRIVMSG ChanServ :%s\r\n" % " ".join(rep2[4:]))
- if (rep2[3].lower() == ":!nickserv" or rep2[3].lower() == ":!ns") and trusted: #Comando que envía un mensaje a NickServ.
- IRC.send("PRIVMSG NickServ :%s\r\n" % " ".join(rep2[4:]))
- if rep2[3].lower() == ":!deop" and trusted: #Comando que quita el status de op al usuario
- try:
- IRC.send("MODE %s -o %s\r\n" % (rep2[4], rep2[5]))
- except IndexError:
- IRC.send("MODE %s -o %s\r\n" % (rep2[2], rep2[4]))
- if rep2[3].lower() == ":!devoice" and trusted:
- try:
- IRC.send("MODE %s -v %s\r\n" % (rep2[4], rep2[5]))
- except IndexError:
- IRC.send("MODE %s -v %s\r\n" % (rep2[2], rep2[4]))
- if rep2[3].lower() == ":!flood":
- IRC.send("PRIVMSG %s :%s\r\n" % (rep2[2], "Está prohibido floodear con pena de ban indefinido."))
- if rep2[3].lower() == ":!google":
- IRC.send("PRIVMSG %s :%s\r\n" % (rep2[2], "https://www.google.com/#q=" + "+".join(rep2[4:])))
- if rep2[3].lower() == ":!help" or rep2[3].lower() == ":!ayuda":
- IRC.send("PRIVMSG %s :%s\r\n" % (rep2[2], "http://skygenrepo.weebly.com/LifeBot.html" + lang_LifeBot + "/LifeBot"))
- if rep2[3].lower() == ":!ip":
- IRC.send("PRIVMSG %s :%s\r\n" % (rep2[2], "https://whatismyipaddress.com/ip/" + rep2[4]))
- if rep2[3].lower() == ":!join":
- IRC.send("JOIN %s\r\n" % rep2[4])
- if rep2[3].lower() == ":!kick" and trusted:
- if " ".join(rep2[5:]) != "":
- IRC.send("KICK %s %s :%s\r\n" % (rep2[2], rep2[4], " ".join(rep2[5:])))
- else:
- IRC.send("KICK %s %s\r\n" % (rep2[2], rep2[4]))
- if rep2[3].lower() == ":!kickban" and trusted:
- IRC.send("MODE %s +b %s\r\n" % (rep2[2], rep2[4]))
- if " ".join(rep2[5:]) != "":
- IRC.send("KICK %s %s :%s\r\n" % (rep2[2], rep2[4], " ".join(rep2[5:])))
- else:
- IRC.send("KICK %s %s\r\n" % (rep2[2], rep2[4]))
- if rep2[3].lower() == ":!love":
- IRC.send("PRIVMSG %s :%s\r\n" % (rep2[2], "Yo también te amo"))
- IRC.send("PRIVMSG %s :%s\r\n" % (rep2[2], "Pero a veces... te odio."))
- if rep2[3].lower() == ":!mode" and trusted:
- try:
- IRC.send("MODE %s %s %s\r\n" % (rep2[4], rep2[5], rep2[6]))
- except IndexError:
- IRC.send("MODE %s %s %s\r\n" % (rep2[2], rep2[4], rep2[5]))
- if rep2[3].lower() == ":!modechan" and trusted:
- try:
- IRC.send("MODE %s %s\r\n" % (rep2[4], rep2[5]))
- except IndexError:
- IRC.send("MODE %s %s\r\n" % (rep2[2], rep2[4]))
- if rep2[3].lower() == ":!news" or rep2[3].lower() == ":!wikinews":
- IRC.send("PRIVMSG %s :%s\r\n" % (rep2[2], "http://" + rep2[4] + ".wikinews.org/wiki/" + "_".join(rep2[5:])))
- if rep2[3].lower() == ":!voyage" or rep2[3].lower() == ":!wikivoyage":
- IRC.send("PRIVMSG %s :%s\r\n" % (rep2[2], "http://" + rep2[4] + ".wikivoyage.org/wiki/" + "_".join(rep2[5:])))
- if rep2[3].lower() == ":!nick" and trusted: #Aquí, un comando que cambia el nick del bot en IRC
- IRC.send("NICK %s\r\n" % rep2[4])
- if rep2[3].lower() == ":!op" and trusted:
- try:
- IRC.send("MODE %s +o %s\r\n" % (rep2[4], rep2[5]))
- except IndexError:
- IRC.send("MODE %s +o %s\r\n" % (rep2[2], rep2[4]))
- if rep2[3].lower() == ":!part" or rep2[3].lower() == ":!quit":
- IRC.send("PART %s\r\n" % rep2[4])
- if rep2[3].lower() == ":!plagio":
- IRC.send("PRIVMSG %s :%s\r\n" % (rep2[2], "http://plagiarisma.net/es/"))
- if rep2[3].lower() == ":!quiet" and trusted:
- try:
- IRC.send("MODE %s +q %s\r\n" % (rep2[4], rep2[5]))
- except IndexError:
- IRC.send("MODE %s +q %s\r\n" % (rep2[2], rep2[4]))
- if rep2[3].lower() == ":!unban" and trusted:
- try:
- IRC.send("MODE %s -b %s\r\n" % (rep2[4], rep2[5]))
- except IndexError:
- IRC.send("MODE %s -b %s\r\n" % (rep2[2], rep2[4]))
- if rep2[3].lower() == ":!unquiet" and trusted:
- try:
- IRC.send("MODE %s -q %s\r\n" % (rep2[4], rep2[5]))
- except IndexError:
- IRC.send("MODE %s -q %s\r\n" % (rep2[2], rep2[4]))
- if rep2[3].lower() == ":!version" or rep2[3].lower() == ":!ver":
- IRC.send("PRIVMSG %s :%s\r\n" % (rep2[2], ver + " Versión de LifeBot : " + ver_LifeBot + " " + lang_LifeBot))
- if rep2[3].lower() == ":!viki" or rep2[3].lower() == ":!vikidia" or rep2[3].lower() == ":!vk":
- IRC.send("PRIVMSG %s :%s\r\n" % (rep2[2], "http://" + rep2[4] + ".vikidia.org/wiki/" + "_".join(rep2[5:])))
- if rep2[3].lower() == ":!voice" and trusted:
- try:
- IRC.send("MODE %s +v %s\r\n" % (rep2[4], rep2[5]))
- except IndexError:
- IRC.send("MODE %s +v %s\r\n" % (rep2[2], rep2[4]))
- if rep2[3].lower() == ":!wp" or rep2[3].lower() == ":!wikipedia":
- IRC.send("PRIVMSG %s :%s\r\n" % (rep2[2], "http://" + rep2[4] + ".wikipedia.org/wiki/" + "_".join(rep2[5:])))
- #No editar nada después de esta línea si no tienes conocimientos de Python.
- if user_bot.lower() + " es bonito" in " ".join(rep2[3:]).lower() or "el bot es bonito" + user_bot.lower() in " ".join(rep2[3:]).lower():
- IRC.send("PRIVMSG %s :%s\r\n" % (rep2[2], "¡Gracias!, tú también eres bonito :)"))
- except IndexError:
- IRC.send("PRIVMSG %s :%s\r\n" % (rep2[2], "Faltan parámetros."))
- #¡No olvides probar y guardar las modificaciones!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement