def __init__(self, irc):
        self.irc = irc
        self.settings = yaml_loader(True, "urltitlefetcher")

        self.channels = {}

        self.help = {
            "urltitle": "Toggle url title fetching for the current channel.\n"
            + ("Usage: %surltitle [all|on|off]\n" % self.irc.control_char)
            + "all = all users, on = voiced and up, off = no-one",
            "title": "Fetch the title of a given URL, or the last URL sent to the channel if no URL is given.\n"
            + ("Usage: %stitle [url]\n" % self.irc.control_char)
            + "NOTE: If title fetching is off in the current channel, this will notice the user rather than message the channel if they are not voiced or above.",
            "shorturl": "Get a short URL for a given URL, or the last URL sent to the channel if no URL is given.\n"
            + ("Usage: %sshorturl [url]\n" % self.irc.control_char)
            + "NOTE: If title fetching is off in the current channel, this will notice the user rather than message the channel if they are not voiced or above.",
        }

        self.YOUTUBE_LOGO = irc.col + "01,00YOU" + irc.col + "00,04TUBE" + irc.col
        self.OUTPUT_YOUTUBE_VIDEO = "[" + self.YOUTUBE_LOGO + " Video] %s (%s) by %s, %s likes, %s dislikes, %s views"
        self.OUTPUT_YOUTUBE_PLAYLIST = "[" + self.YOUTUBE_LOGO + ' Playlist] %s (%s videos, total %s) by %s - "%s"'
        self.OUTPUT_YOUTUBE_CHANNEL = (
            "[" + self.YOUTUBE_LOGO + ' Channel] %s (%s subscribers, %s videos with %s total views) - "%s"'
        )

        self.YOUTUBE_DESCRIPTION_LENGTH = 75

        self.OSU_LOGO = irc.col + "13osu!" + irc.col
        self.OSU_MAP_FORMAT = "[" + self.OSU_LOGO + " map] %s [%s]"
예제 #2
0
 def __init__(self, irc, api_keys):
     Resource.__init__(self)
     self.api_keys = api_keys
     self.irc = irc
     settings_handler = yaml_loader(True, "web")
     settings = settings_handler.load("github", {"projects": {"McBlockit---Helpbot": ["#archives"]}})
     self.repos = settings["projects"]
예제 #3
0
    def __init__(self, irc):
        self.irc = irc
        self.help = {
            #            "test": "You must be really bored, eh?\nUsage: %stest" % self.irc.control_char
        }

        self.settings_handler = yaml_loader(True, "feeds")
        self.load()
예제 #4
0
    def __init__(self, irc):
        self.irc = irc
        self.help = {
            #            "test": "You must be really bored, eh?\nUsage: %stest" % self.irc.control_char
        }

        self.settings_handler = yaml_loader(True, "feeds")
        self.load()
예제 #5
0
    def __init__(self, irc):
        self.irc = irc
        self.help = {
                        "awaynick": "Used to manage away nicks for rank dropping.\n"
                                    "Usage: %sawaynick <add|del> nickname" % self.irc.control_char,
                        "awaynicks": "Lists added away nicks for rank dropping.\n"
                                     "Usage: %sawaynicks" % self.irc.control_char
        }

        self.settings_handler = yaml_loader(True, "awaylower")
        self.load()
예제 #6
0
    def __init__(self, irc):
        self.irc = irc
        self.guns_handler = yaml_loader(True, "rroulette")
        self.stats_handler = yaml_loader(True, "rroulette")
        self.guns = self.guns_handler.load("guns")["guns"]
        self.stats = self.stats_handler.load("stats")

        self.channels = {}
        self.users = {}

        self.help = {
            "rroulette": "Bite the bullet.. or not?\nUsage: %srroulette" % self.irc.control_char,
            "shoot": "Shoot someone.\n" +
                     ("Usage: %sshoot <user>[:channel]\n" % self.irc.control_char) +
                     "NOTE: If opped and you are a voice or higher, this will kick the user.",
            "rstats": "Get stats about people and channels using this plugin.\n" +
                     "Usage: " + self.irc.control_char + "rstats <user/channel> <username/channelname> [stat]\n" +
                     "Valid stats: all, shots, deaths, players (Channel only), chambers (Channel only), games (User only)\n" +
                     "NOTE: If no stat is included, all stats will be returned."
        }
예제 #7
0
    def __init__(self, irc):
        self.irc = irc
        self.help = {
        }

        self.settings_handler = yaml_loader(True, "web")
        self.settings = self.settings_handler.load("settings", {"api_keys": [], "port": 8080})

        resource = BaseResource(irc, self.settings, self._intercom_send)
        factory = Site(resource)
        reactor.listenTCP(self.settings["port"], factory)
예제 #8
0
    def __init__(self, irc):
        self.irc = irc
        self.settings = yaml_loader(True, "brainfuck")

        self.DEFAULT_MAX_EXEC_TIME = 300
        self.max_exec_time = self.DEFAULT_MAX_EXEC_TIME

        self.help = {
            "brainfuck": "Run a snippet of brainfuck code.",
            "brainfucktime": "Set maximum runtime for the brainfuck interpreter.",
        }
예제 #9
0
파일: memo.py 프로젝트: gdude2002/Pippi
    def __init__(self, irc):
        self.irc = irc
        self.memos_handler = yaml_loader(True, "memos")
        self.memos = self.memos_handler.load("memos")
        self.bans_handler = yaml_loader(True, "memos")
        self.bans = self.bans_handler.load("bans")
        if not self.memos:
            self.memos = {}

        if not self.bans:
            self.bans = {"memos": []}

        self.channels = {}
        self.users = {}

        self.help = {
            "memo": "Tells the bot to send a message to the user next time the user says something in the channel.\nUsage: %smemo <user> <message>" % self.irc.control_char
            ,
            "memoban": "Tells the bot to ignore memos from a user.\nUsage: %smemoban <user>\nNOTE: Needs logged into the bot." % self.irc.control_char,
            "memounban": "Tells the bot to stop ignoring memos from a user.\nUsage: %smemounban <user>\nNOTE: Needs to be logged into the bot." %self.irc.control_char
            ,
            }
예제 #10
0
    def __init__(self, irc):
        self.irc = irc
        self.items_handler = yaml_loader(True, "items")
        self.items = self.items_handler.load("items")
        self.bans_handler = yaml_loader(True, "items")
        self.bans = self.bans_handler.load("bans")
        if not self.items:
            self.items = {}

        if not self.bans:
            self.bans = {"items": []}

        self.channels = {}
        self.users = {}

        self.help = {
            "put": "Add an item to the bot's inventory.\nUsage: %sput <item>" % self.irc.control_char,
            "get": "Get a random item from the bot's inventory.\nUsage: %sget" % self.irc.control_char,
            "remove": "Remove an item from the bot's inventory. Also bans the item.\nUsage: %sremove <item>\nNOTE: Needs op or higher" % self.irc.control_char
            ,
            "inventory": "Get a list of items in the bot's inventory.\nUsage: %sinventory <item>\nNOTE: Needs op or higher" % self.irc.control_char
            ,
            }
예제 #11
0
    def __init__(self, path, bot):
        self.path = path
        if not os.path.exists(path):
            os.mkdir(path)
        self.bot = bot
        self.evalObj = evalFunctions(bot)

        settings = yaml_loader()
        settings = settings.load("config/settings.yml")["faq"]

        self.config["type"] = settings["type"]
        location = settings["location"]
        if location[-1] == "/" or location[-1] == "\\":
            self.config["location"] = location
        else:
            self.config["location"] = location + "/"
        self.config["name"] = settings["name"]
        self.config["num_colours"] = int(settings["colours"])
        self.config["css"] = settings["css"]

        self.config["colours"] = settings["generated_colours"]
예제 #12
0
    def render_POST(self, request):
        print "[WEB] %s %s: %s" % (request.getClientIP(), request.method, request.uri)
        if not authorized(self.api_keys, request):
            print "[WEB] -> 401 Not Authorized"
            request.setResponseCode(401)
            request.setHeader("content-type", "text/html; charset=utf-8")
            return "<html><head><title>401 - Not Authorized</title></head><body><h1>Not Authorized</h1><p>You are not "\
                   "authorized to access this resource. Perhaps you're missing an API key?</p></body></html>"
        settings_handler = yaml_loader(True, "web")
        settings = settings_handler.load("github")
        self.repos = settings["projects"]
        try:
            for payload in request.args["payload"]:
                payload = json.loads(payload)
                repo = payload["repository"]
                head = payload["head_commit"]

                author = head["author"]["name"]
                repo_name = repo["name"]
                added = len(head["added"])
                modified = len(head["modified"])
                removed = len(head["removed"])
                message = head["message"]
                if "\n" in message:
                    message = message.split("\n")[0]
                commits = len(payload["commits"])

                if repo_name in self.repos:
                    for channel in self.repos[repo_name]:
                        self.irc.sendmsg(channel, "%s pushed a commit to %s (%sa/%sm/%sd) - \"%s\" [Total: %s commits]" %
                                                  (author, repo_name, added, modified, removed, message, commits))
                else:
                    print "[WEB] Alert - Recieved data for a repo we don't follow: \"%s\"" % repo_name
                    return json.dumps({"result": "error", "error": "Not following that repo!"})
        except Exception as e:
            print "[WEB] Error: %s" % e
            return json.dumps({"result": "error", "error": str(e)})
        else:
            return json.dumps({"result": "success"})
예제 #13
0
 def loadconfigs(self, user=False, *args):
     self.settings_handler = yaml_loader(True, "lyrics")
     self.settings = self.settings_handler.load("settings")
     self.lyrics = self.settings_handler.load("lyrics")
     if user: self.irc.send_raw("NOTICE " + user + " :" + 'Lyrics reloaded!')
예제 #14
0
# coding=utf-8
from system.irc import *
from system.yaml_loader import *
import sys, os

if not os.path.exists("config/settings.yml"):
    print "|! Couldn't find settings.yml!"
    print "|! Copy the settings.yml.example to settings.yml and edit it as required."
    print "|! After that, run the bot again."
    exit(1)

sys.path.append("./depends")

settings = yaml_loader().load("config/settings.yml")
factory = BotFactory()
reactor.connectTCP(
    settings["connection"]["host"],
    settings["connection"]["port"],
    factory, 120)
del settings
colprint("|= Starting up..")
reactor.run()
colprint("0\n")