Esempio n. 1
0
def main():
    src.logger(None)("Connecting to {0}:{1}{2}".format(botconfig.HOST, "+" if botconfig.USE_SSL else "", botconfig.PORT))
    cli = IRCClient(
                      {"privmsg": handler.on_privmsg,
                       "notice": lambda a, b, c, d: handler.on_privmsg(a, b, c, d, True),
                       "": handler.unhandled},
                     host=botconfig.HOST,
                     port=botconfig.PORT,
                     authname=botconfig.USERNAME,
                     password=botconfig.PASS,
                     nickname=botconfig.NICK,
                     ident=botconfig.IDENT,
                     real_name=botconfig.REALNAME,
                     sasl_auth=botconfig.SASL_AUTHENTICATION,
                     server_pass=botconfig.SERVER_PASS,
                     use_ssl=botconfig.USE_SSL,
                     connect_cb=handler.connect_callback,
                     stream_handler=src.stream,
    )
    cli.mainLoop()
Esempio n. 2
0
File: wolfbot.py Progetto: io4/lykos
def main():
    src.logger(None)("Connecting to {0}:{1}{2}".format(
        botconfig.HOST, "+" if botconfig.USE_SSL else "", botconfig.PORT))
    cli = IRCClient(
        {
            "privmsg": handler.on_privmsg,
            "notice": lambda a, b, c, d: handler.on_privmsg(a, b, c, d, True),
            "": handler.unhandled
        },
        host=botconfig.HOST,
        port=botconfig.PORT,
        authname=botconfig.USERNAME,
        password=botconfig.PASS,
        nickname=botconfig.NICK,
        ident=botconfig.IDENT,
        real_name=botconfig.REALNAME,
        sasl_auth=botconfig.SASL_AUTHENTICATION,
        server_pass=botconfig.SERVER_PASS,
        use_ssl=botconfig.USE_SSL,
        connect_cb=handler.connect_callback,
        stream_handler=src.stream,
    )
    cli.mainLoop()
Esempio n. 3
0
# The bot commands implemented in here are present no matter which module is loaded

import base64
import imp
import socket
import traceback

import botconfig
from oyoyo.parse import parse_nick
from src import decorators
from src import logger
from src import settings as var
from src import wolfgame

log = logger("errors.log")
alog = logger(None)


def notify_error(cli, chan, target_logger):
    msg = "An error has occurred and has been logged."

    tb = traceback.format_exc()

    target_logger(tb)

    if (not botconfig.PASTEBIN_ERRORS) or (chan != botconfig.DEV_CHANNEL):
        # Don't send a duplicate message if DEV_CHANNEL is the current channel.
        cli.msg(chan, msg)

    if botconfig.PASTEBIN_ERRORS and botconfig.DEV_CHANNEL:
        try:
Esempio n. 4
0
import fnmatch
from collections import defaultdict

from oyoyo.parse import parse_nick

import botconfig
import src.settings as var
from src import logger

adminlog = logger("audit.log")

COMMANDS = defaultdict(list)
HOOKS = defaultdict(list)

class cmd:
    def __init__(self, *cmds, raw_nick=False, admin_only=False, owner_only=False,
                 chan=True, pm=False, playing=False, silenced=False, phases=(), roles=()):

        self.cmds = cmds
        self.raw_nick = raw_nick
        self.admin_only = admin_only
        self.owner_only = owner_only
        self.chan = chan
        self.pm = pm
        self.playing = playing
        self.silenced = silenced
        self.phases = phases
        self.roles = roles
        self.func = None
        self.aftergame = False
        self.name = cmds[0]
Esempio n. 5
0
# The bot commands implemented in here are present no matter which module is loaded

import base64
import socket
import sys
import traceback

from oyoyo.parse import parse_nick

import botconfig
import src.settings as var
from src import decorators, logger, wolfgame

log = logger("errors.log")
alog = logger(None)

hook = decorators.hook

def on_privmsg(cli, rawnick, chan, msg, notice = False):
    try:
        prefixes = getattr(var, "STATUSMSG_PREFIXES")
    except AttributeError:
        pass
    else:
        if botconfig.IGNORE_HIDDEN_COMMANDS and chan[0] in prefixes:
            return

    try:
        getattr(var, "CASEMAPPING")
    except AttributeError:
        # some kind of hack for strange networks which don't put server name in some of the NOTICEs on startup
Esempio n. 6
0
import configparser

import numpy as np
import skvideo.io as skvio
import skimage.draw as skd
from tqdm import tqdm

from src import video
from src import logger
from src import tmeasure

# ---

ROI_LIFESPAN = 30

log = logger(name=__name__[2:-2])
cfg = configparser.ConfigParser()

# ---


def load(fname: str) -> np.ndarray:
    vid = skvio.vread(fname)
    n, h, w, depth = vid.shape
    if depth != 3:
        print('You need to provide a colored video!')
        sys.exit(2)

    log.info('loaded video with %d frames and resulution %d, %d', n, h, w)

    return vid
Esempio n. 7
0
import traceback
import fnmatch
import socket
import types
from collections import defaultdict

from oyoyo.client import IRCClient
from oyoyo.parse import parse_nick

import botconfig
import src.settings as var
from src.utilities import *
from src import logger
from src.messages import messages

adminlog = logger("audit.log")
errlog = logger("errors.log")

COMMANDS = defaultdict(list)
HOOKS = defaultdict(list)

# Error handler decorators

class handle_error:

    def __new__(cls, func):
        if isinstance(func, cls): # already decorated
            return func

        self = super().__new__(cls)
        self.func = func
Esempio n. 8
0
import botconfig
import src
from src import handler


def main():
    cli = IRCClient(
                      {"privmsg": handler.on_privmsg,
                       "notice": lambda a, b, c, d: handler.on_privmsg(a, b, c, d, True),
                       "": handler.unhandled},
                     host=botconfig.HOST,
                     port=botconfig.PORT,
                     authname=botconfig.USERNAME,
                     password=botconfig.PASS,
                     nickname=botconfig.NICK,
                     ident=botconfig.IDENT,
                     real_name=botconfig.REALNAME,
                     sasl_auth=botconfig.SASL_AUTHENTICATION,
                     use_ssl=botconfig.USE_SSL,
                     connect_cb=handler.connect_callback,
                     stream_handler=src.stream,
    )
    cli.mainLoop()


if __name__ == "__main__":
    try:
        main()
    except Exception:
        src.logger("errors.log")(traceback.format_exc())
Esempio n. 9
0
# All rights reserved.

# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

# Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
# Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import fnmatch

import botconfig
import src.settings as var
from oyoyo.parse import parse_nick
from src import logger

adminlog = logger(None)

def generate(fdict, permissions=True, **kwargs):
    """Generates a decorator generator.  Always use this"""
    def cmd(*s, raw_nick=False, admin_only=False, owner_only=False, chan=True, pm=False,
                game=False, join=False, none=False, playing=False, roles=(), hookid=-1):
        def dec(f):
            def innerf(*args):
                largs = list(args)
                rawnick = largs[1]
                if not permissions:
                    return f(*largs)
                if len(largs) > 1 and largs[1]:
                    nick, _, _, cloak = parse_nick(largs[1])

                    if cloak is None:
Esempio n. 10
0
import fnmatch
from collections import defaultdict

from oyoyo.parse import parse_nick

import botconfig
import src.settings as var
from src import logger

adminlog = logger("audit.log")

COMMANDS = defaultdict(list)
HOOKS = defaultdict(list)


class cmd:
    def __init__(self,
                 *cmds,
                 raw_nick=False,
                 admin_only=False,
                 owner_only=False,
                 chan=True,
                 pm=False,
                 playing=False,
                 silenced=False,
                 phases=(),
                 roles=()):

        self.cmds = cmds
        self.raw_nick = raw_nick
        self.admin_only = admin_only