Exemple #1
0
    def showtraceback(self):
        type, value, lasttb = sys.exc_info()
        self.irc.msg(self.channel, "{0}: {1}".format(type.__name__, value))

    def showsyntaxerror(self, filename):
        self.showtraceback()

def repl(irc, source, msgtarget, args):
    if utils.isAdmin(irc, source):
        irc.repls.run(msgtarget, args)

utils.add_cmd(repl, ">>")

def multirepl(irc, source, msgtarget, args):
    args = args[0]
    if utils.isAdmin(irc, source) and irc.multirepl == True and args != '"""':
        irc.repl+=args+"\n"

utils.add_regex(multirepl, "(.*)")

def multireplprefix(irc, source, msgtarget, args):
    if utils.isAdmin(irc, source):
        if irc.multirepl == True:
            irc.multirepl = False
            irc.repls.run(msgtarget, irc.repl)
            irc.repl = ""
        else:
            irc.multirepl = True

utils.add_regex(multireplprefix, '"""')
Exemple #2
0
from utils import add_regex
from bs4 import BeautifulSoup
from requests import get
import re

def title_snarfer(irc, source, msgtarget, args):
    if msgtarget in irc.title_snarfer_allowed:
        if args[0].split("//")[1].split("/")[0] not in irc.title_snarfer_ignored_urls:
            try:
                title = BeautifulSoup(get(args[0], timeout=3).content.decode()).title.text
                irc.msg(msgtarget, "Title: {}".format(re.sub("\s+", " ", title))[0:250])
            except AttributeError:
                pass

add_regex(title_snarfer, "(http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[~!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)")
Exemple #3
0
from utils import add_regex
from bs4 import BeautifulSoup
from requests import get
import re


def title_snarfer(irc, source, msgtarget, args):
    if msgtarget in irc.title_snarfer_allowed:
        if args[0].split("//")[1].split(
                "/")[0] not in irc.title_snarfer_ignored_urls:
            try:
                title = BeautifulSoup(
                    get(args[0], timeout=3).content.decode()).title.text
                irc.msg(msgtarget,
                        "Title: {}".format(re.sub("\s+", " ", title))[0:250])
            except AttributeError:
                pass


add_regex(
    title_snarfer,
    "(http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[~!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)"
)