Ejemplo n.º 1
0
import re
import sys
import time
import sopel
import sopel.module
import sopel.web
from sopel.bot import _CapReq
from sopel.tools import Identifier, iteritems, events
from sopel.tools.target import User, Channel
import base64
from sopel.logger import get_logger

if sys.version_info.major >= 3:
    unicode = str

LOGGER = get_logger(__name__)

batched_caps = {}
who_reqs = {}  # Keeps track of reqs coming from this module, rather than others


def auth_after_register(bot):
    """Do NickServ/AuthServ auth"""
    if bot.config.core.auth_method == 'nickserv':
        nickserv_name = bot.config.core.auth_target or 'NickServ'
        bot.msg(
            nickserv_name,
            'IDENTIFY %s' % bot.config.core.auth_password
        )

    elif bot.config.core.auth_method == 'authserv':
Ejemplo n.º 2
0
from random import randint
import re
import sys
import time
import sopel
import sopel.module
from sopel.bot import _CapReq
from sopel.tools import Identifier, iteritems, events
from sopel.tools.target import User, Channel
import base64
from sopel.logger import get_logger

if sys.version_info.major >= 3:
    unicode = str

LOGGER = get_logger(__name__)

batched_caps = {}
who_reqs = {
}  # Keeps track of reqs coming from this module, rather than others


def auth_after_register(bot):
    """Do NickServ/AuthServ auth"""
    if bot.config.core.auth_method == 'nickserv':
        nickserv_name = bot.config.core.auth_target or 'NickServ'
        bot.msg(nickserv_name, 'IDENTIFY %s' % bot.config.core.auth_password)

    elif bot.config.core.auth_method == 'userserv':
        userserv_name = bot.config.core.auth_target or 'UserServ'
        account = bot.config.core.auth_username
Ejemplo n.º 3
0
import json
import re

import oauth2 as oauth

from sopel import plugin, tools
from sopel.config.types import (
    BooleanAttribute,
    ListAttribute,
    StaticSection,
    ValidatedAttribute,
    NO_DEFAULT,
)
from sopel.logger import get_logger

logger = get_logger(__name__)

DOMAIN_REGEX = r"https?://(?:m(?:obile)?\.)?twitter\.com/"
STATUS_REGEX = r"(?:\w+|i/web)/status/(?P<status>\d+)"
USER_REGEX = r"(?P<user>\w+)/?(?:\?.*)?$"


class TwitterSection(StaticSection):
    consumer_key = ValidatedAttribute('consumer_key', default=NO_DEFAULT)
    consumer_secret = ValidatedAttribute('consumer_secret', default=NO_DEFAULT)
    show_quoted_tweets = BooleanAttribute('show_quoted_tweets', default=True)
    alternate_domains = ListAttribute(
        "alternate_domains",
        default=["vxtwitter.com", "nitter.net"],
    )
Ejemplo n.º 4
0
Archivo: help.py Proyecto: dasu/sopel
Copyright © 2013, Elad Alfassa, <*****@*****.**>
Copyright © 2018, Adam Erdman, pandorah.org
Licensed under the Eiffel Forum License 2.

http://sopel.chat
"""
from __future__ import unicode_literals, absolute_import, print_function, division

import textwrap
import collections
import requests

from sopel.logger import get_logger
from sopel.module import commands, rule, example, priority

logger = get_logger(__name__)


def setup(bot):
    global help_prefix
    help_prefix = bot.config.core.help_prefix


@rule('$nick' '(?i)(help|doc) +([A-Za-z]+)(?:\?+)?$')
@example('.help tell')
@commands('help', 'commands')
@priority('low')
def help(bot, trigger):
    """Shows a command's documentation, and possibly an example."""
    if trigger.group(2):
        name = trigger.group(2)
Ejemplo n.º 5
0
# coding=utf-8
# Copyright 2017 Matt Hart
# Licensed under the Eiffel Forum License 2

#from __future__ import unicode_literals, absolute_import, print_function, division

import xmltodict
import xmlrpc.client
from urllib.parse import urlparse

from sopel.config.types import StaticSection, ValidatedAttribute
from sopel.module import thread, interval
from sopel.logger import get_logger

LOG = get_logger(__name__)


class LAVASection(StaticSection):
    url = ValidatedAttribute('url')


def configure(config):
    config.define_section('lava', LAVASection)
    config.lava.configure_setting('url', 'Enter your LAVA url (https://lkft.validation.linaro.org)')


def setup(bot):
    bot.config.define_section('lava', LAVASection)
    if not bot.config.lava.url:
        return
Ejemplo n.º 6
0
import re
import sys
import threading
import time

from sopel import irc, logger, plugins, tools
from sopel.db import SopelDB
from sopel.tools import stderr, Identifier, deprecated
import sopel.tools.jobs
from sopel.trigger import Trigger
from sopel.module import NOLIMIT
import sopel.loader

__all__ = ['Sopel', 'SopelWrapper']

LOGGER = logger.get_logger(__name__)

if sys.version_info.major >= 3:
    unicode = str
    basestring = str
    py3 = True
else:
    py3 = False


class _CapReq(object):
    def __init__(self, prefix, module, failure=None, arg=None, success=None):
        def nop(bot, cap):
            pass

        # TODO at some point, reorder those args to be sane
Ejemplo n.º 7
0
# coding=utf-8

from __future__ import unicode_literals, absolute_import, division, print_function

from sopel import module
from sopel.logger import get_logger
import os
import lupa
import json


LOGGER = get_logger("lua")


def configure(config):
    pass


def setup(bot):
    dirname = os.path.join(os.path.dirname(os.path.abspath(__file__)), "sandbox")
    try:
        os.mkdir(dirname)
    except OSError as e:
        pass


class TriggerWrapper:
    def __init__(self, trigger):
        self._trigger = trigger

    def __getattr__(self, name):