Esempio n. 1
0
    def _core(self):
        self.interactive_add('nick', 'Enter the nickname for your bot', 'Willie')
        self.interactive_add('name', 'Enter the "real name" of you bot for WHOIS responses',
                             'Willie Embosbot, http://willie.dftba.net')
        self.interactive_add('host', 'Enter the server to connect to', 'irc.dftba.net')
        self.interactive_add('port', 'Enter the port to connect on', '6667')
        
        c='Enter the channels to connect to by default, one at a time. When done, hit enter again.'
        self.add_list('channels', c, 'Channel:')
                
        self.interactive_add('owner', "Enter your own IRC name (or that of the bot's owner)")
        self.interactive_add('debug_target', 'Enter the channel to print debugging messages to. If set to stdio, debug messages will be printed to standard output', 'stdio')
        
        self.interactive_add('verbose', 'Verbosity level. If None, all debug messages will be discarded. Valid options are warning/verbose/none', 'None') #FIXME: Make this a bit more user friendly
        
        c="List users you'd like "+self.nick+" to ignore (e.g. other bots), one at a time. Hit enter when done."
        self.add_list('other_bots', c, 'Nick:')
        
        self.interactive_add('password', "Enter the bot's NickServ password", 'None', ispass=True)
        self.interactive_add('serverpass', "Enter the bot's server password", 'None', ispass=True)
        
        oper = self.option("Will this bot have IRC Operator privilages")
        if oper:
            opername = raw_input("Operator name:")
            operpass = getpass.getpass("Operator password:"******"Oper = ('"+opername+"', '"+operpass+"')"
        else: self.operline = "# Oper = ('opername', 'operpass')"
        
        #Note that this won't include owner. Will insert that later.

        c='Enter other users who can perform some adminstrative tasks, one at a time. When done, hit enter again.'
        self.add_list('admins', c, 'Nick:')
        
        c=trim("""\
        If you have any modules you do not wish this bot to load, enter them now, one at
        a time. When done, hit enter. (If you'd rather whitelist modules, leave this empty.)""")
        self.add_list('exclude', c, 'Module:')
        
        if not self.exclude:
            wl = self.option("Would you like to create a module whitelist")
            self.enable = []
            if wl:
                c="Enter the modules to use, one at a time. Hit enter when done."
                self.add_list('enable', c, 'Module:')

        c = trim("""\
        If you'd like to include modules from other directories, enter them one at a
        time, and hit enter again when done.""")
        self.add_list('extra', c, 'Directory:')
Esempio n. 2
0
 def _settings(self):
     try:
         import settings
         self.settings_chunk = trim(settings.write_config(self))
         self.settings = True
     except: 
         self.settings = False
         self.settings_chunk = trim("""\
         
         # ------------------  USER DATABASE CONFIGURATION  ------------------
         # The user database was not set up at install. Please consult the documentation,
         # or run the configuration utility if you wish to use it.""")
     
     print trim("""
     The configuration utility will now attempt to find modules with their own
     configuration needs.
     """)
Esempio n. 3
0
    def test_long_paragraph(self):
        paragraph = trim("""
        ubit.info(유빗인포)는 코나미 리듬게임, 유비트의 플레이 데이터 관리 및 열람 서비스입니다. 등록 후에 자신과 친구의 기록을 p.eagate.573.jp에 접속할 필요 없이 본 웹 사이트에서 바로 확인할 수 있습니다.
        등록 후에는 "https://ubit.info/별칭"으로 자신의 개인 페이지가 생성되며 이 주소(별칭)를 아는 사람만 접속할 수 있습니다. 다른 친구에게 기록을 보여주고 싶다면 본인의 인포 주소를 알려주면 됩니다.
        이 사이트는 최신 브라우저 환경만을 제대로 지원합니다. 만약 크롬, 파이어폭스 등의 최신 브라우저 안정버전(stable)을 사용하고 있는데도 페이지 레이아웃이 깨지는 경우 사이트 관리자에게 문의해주세요.
        등록 과정은 간단합니다. 상단 메뉴에서 등록을 클릭한 후 양식에 맞게 입력하시면 자동으로 공개설정이 완료됨과 동시에 유빗인포 계정이 생성됩니다.
        """)

        result = spell_checker.check(paragraph)
Esempio n. 4
0
def create_default_config(fn): 
   f = open(fn, 'w')
   print >> f, trim("""\
   nick = 'caesar'
   host = 'irc.example.net'
   channels = ['#example', '#test']
   owner = 'yournickname'

   # These are people who will be able to use admin.py's functions...
   admins = [owner, 'someoneyoutrust']
   # But admin.py, mcstatus.py and services.py are disabled by default, as follows:
   exclude = ['admin', 'mcstatus', 'services']

   # Services
   # Services are disabled by default, see the exclude list above
   # Email address for registering the bot with, will be used for all nick registrations
   email = 'emailhere'
   # NickServ
   # NickServ password for the bot to login with
   nickservpass = '******'
   # HostServ
   # This will request a vhost for your bot once it's nick is registered
   vhost = 'vhost.you.want'
   # ChanServ
   # Logging in to channels
   # cshannel is the channel you want to log in to, chanservpass is it's password
   cschannel = '#channel'
   chanservpass = '******'
   # Autovoicing
   # caesar can autovoice any nick who joins the channel specified below
   # bot must have op in the channel for this to work
   autovoicechan = '#channel'
   
   # If you want to enumerate a list of modules rather than disabling
   # some, use "enable = ['example']", which takes precedent over exclude
   # 
   # enable = []

   # Directories to load user modules from
   # e.g. /path/to/my/modules
   extra = []

   # Services to load: maps channel names to white or black lists
   external = { 
      '#liberal': ['!'], # allow all
      '#conservative': [], # allow none
      '*': ['!'] # default whitelist, allow all
   }

   # EOF
   """)
   f.close()
Esempio n. 5
0
    def _modules(self):
        home = os.getcwd()
        modules_dir = os.path.join(home, 'modules')
        self.modules_chunk = ''

        filenames = enumerate_modules(self)
        os.sys.path.insert(0,modules_dir) 
        for filename in filenames:
            name = os.path.basename(filename)[:-3]
            if name in self.exclude: continue
            try: module = imp.load_source(name, filename)
            except Exception, e:
                print >> sys.stderr, "Error loading %s: %s (in config.py)" % (name, e)
            else:
                if hasattr(module, 'configure'):
                    chunk = module.configure(self)
                    if chunk and isinstance(chunk, basestring):
                        self.modules_chunk += trim(chunk)
Esempio n. 6
0
def info(request, author_id):
    author = User.objects.get(id=author_id)
    if not author or author.type != '2':
        return HttpResponse(
            trim("""\
            <script>
            alert("존재하지 않는 회원이거나 작가가 아닙니다.");
            history.go(-1);
            </script>
        """))
    else:
        author_info = AuthorInfo.objects.get(user=author)
        works = Work.objects.filter(author=author)
        d = {
            'author': author,
            'author_info': author_info,
            'works': works,
        }
        return render_to_response('author/info.html', d)
Esempio n. 7
0
def create_default_config(fn):
    f = open(fn, 'w')
    print >> f, trim("""\
    #-*- coding: utf-8 -*-
    EMAIL = {
        'SMTP_SERVER': 'smtp.gmail.com',
        'SMTP_PORT': 587,
        'SMTP_USER': '',
        'SMTP_PASSWORD': '',
        'SMTP_TLS': True,
        'TARGET': '',
        'TITLE': u'{bank_name} 예금액 변동 알림',
    }

    BANK = {
        'kbstar': {
            'account': '',
            'password': '',
            'resident': '',
            'username': '',
        },
        'hana': {
            'account': '',
            'password': '',
            'resident': '',
        }
    }

    INCLUDE_BANKS = (
        'kbstar',
        'hana',
    )

    # seconds
    REFRESH_INTERVAL = 15
    """)
    f.close()
Esempio n. 8
0
def create_default_config(fn):
    f = open(fn, 'w')
    print >> f, trim("""\
   nick = 'phenny'
   host = 'irc.example.net'
   channels = ['#example', '#test']
   owner = 'yournickname'

   # password is the NickServ password, serverpass is the server password
   # password = '******'
   # serverpass = '******'

   # These are people who will be able to use admin.py's functions...
   admins = [owner, 'someoneyoutrust']
   # But admin.py is disabled by default, as follows:
   exclude = ['admin']

   # If you want to enumerate a list of modules rather than disabling
   # some, use "enable = ['example']", which takes precedent over exclude
   # 
   # enable = []

   # Directories to load user modules from
   # e.g. /path/to/my/modules
   extra = []

   # Services to load: maps channel names to white or black lists
   external = { 
      '#liberal': ['!'], # allow all
      '#conservative': [], # allow none
      '*': ['!'] # default whitelist, allow all
   }

   # EOF
   """)
    f.close()
Esempio n. 9
0
def create_default_config(fn): 
   f = open(fn, 'w')
   print >> f, trim("""\
   nick = 'UnoBot'
   host = 'irc.example.net'
   channels = ['#uno', '#another_channel']
   owner = 'yournickname'

   # password is the NickServ password, serverpass is the server password
   # password = '******'
   # serverpass = '******'

   # These are people who will be able to use admin.py's functions...
   admins = [owner, 'someoneyoutrust']
   # But admin.py is disabled by default, as follows:
   exclude = ['admin']

   # If you want to enumerate a list of modules rather than disabling
   # some, use "enable = ['example']", which takes precedent over exclude
   # 
   # enable = []

   # Directories to load user modules from
   # e.g. /path/to/my/modules
   extra = []

   # Services to load: maps channel names to white or black lists
   external = { 
      '#liberal': ['!'], # allow all
      '#conservative': [], # allow none
      '*': ['!'] # default whitelist, allow all
   }

   # EOF
   """)
   f.close()
Esempio n. 10
0
def create_default_config(fn): 
   f = open(fn, 'w')
   print >> f, trim("""\
   nick = 'botDerechista'
   host = 'irc.ejemplo.net'
   channels = ['#ejemplo', '#test']
   owner = 'tunick'

   # password es la contraseña de NickServ, serverpass es la contraseña del Servidor
   # password = '******'
   # serverpass = '******'

   # Estas personas pueden usar las funciones de admin.py
   admins = [owner, 'alguienqueconfies']
   # Pero admin.py está deshabilitado por defecto, como aparece acá
   exclude = ['admin']

   # Si quieres tomar una lista de módulos y quieres deshabilitarlos, prueba solo con los habilitados.
   # Usa "enable = ['example']", que toma precedencia a cuales deshabilitar
   # 
   # enable = []

   # Directorio de donde cargar el módulo
   # e.g. /path/to/my/modules
   extra = []

   # Cargar servicios
   external = { 
      '#conservative': ['!'], # allow all
      '#comunism': [], # allow none
      '*': ['!'] # default whitelist, allow all
   }

   # EOF
   """)
   f.close()
Esempio n. 11
0
def create_default_config(fn):
    f = open(fn, 'w')
    output = """\
    # Lines that begin with a "#" are comments.
    # Remove the "#" from the beginning of a line to make those lines active.

    nick = 'jenni'
    host = 'irc.example.net'
    port = 6667
    ssl  = False
    sasl = False
    channels = ['#example', '#test']

    # Channel jenni will report all private messages sent to her to.
    # This includes server notices.
    # logchan_pm = '#jenni-log'

    # You can also specify nick@hostmask
    # For example: yano@unaffiliated/yano
    owner = 'yournickname'

    # user is the NickServ userid
    # This is useful if your NickServ user is different than the nick you are using
    # user = '******'

    # password is the NickServ password, serverpass is the server password
    # password = '******'
    # serverpass = '******'


    ## API KEYS

    # forecastio_apikey is for an API key from https://forecast.io/
    # This is useful if you want extended weather information.
    # Required if you want .weather to work.
    # If not, you can use .weather-noaa or .wx-noaa
    # forecastio_apikey = ''

    # wunderground_apikey is for an API key from http://www.wunderground.com/
    # This is useful if you want more local and *live* weather information.
    # This is optional and doesn't need to be added.
    # wunderground_apikey = ''

    # google_dev_apikey is for an API key from Google Developers
    # https://developers.google.com/api-client-library/python/guide/aaa_apikeys
    # Get a Server API Key; this is required for YouTube to work.
    # google_dev_apikey = ''

    # wolframalpha_apikey is for an API key from Wolfram|Alpha
    # http://products.wolframalpha.com/api/
    # This is needed in order to make .calc/.c have more comprehensive answers.
    # wolframalpha_apikey = ''


    # twitter_consumer_key and twitter_consumer_secret are for Twitter's API
    # https://apps.twitter.com/
    # This is needed if you'd like to make .twitter usable
    # twitter_consumer_key = ''
    # twitter_consumer_secret = ''

    # Fill in Yelp API information here
    # This is for using the .food command
    yelp_api_credentials = {
        'consumer_key': '',
        'consumer_secret': '',
        'token': '',
        'token_secret': ''
        }

    # api.ai https://docs.api.ai/docs/get-started

    # apiai_apikey = ''

    # google custom search
    # https://developers.google.com/custom-search/
    # http://stackoverflow.com/a/5615931

    # cse_apikey = ''
    # cse_appid = ''


    # openweathermap
    # owm_apikey = ''

    # You can add bannable words / regex per channel
    # bad_words = {
    #   "#yourchan": ['badword', '(a|b).*c.*(d|e)']
    # }
    #
    # This controls the number of warnings a user will receive
    # before they are banned from the channel
    # bad_word_limit = 1

    # auto_title_disable_chans is for disabling the auto URL title feature
    # simply add a channel to this list (preferably in all lower-case)
    # and it won't auto-title URLs in that channel, but .title and other features
    # will still work
    # auto_title_disable_chans = ['##yano',]

    # These are people who will be able to use admin.py's functions...
    admins = [owner, 'someoneyoutrust']
    # But admin.py is disabled by default, as follows:
    exclude = ['adminchannel', 'chicken_reply', 'insult', 'lispy', 'twss']

    # This allows one to allow specific people to use ".msg channel message here"
    # in specific channels.
    helpers = {
        '#channel1': ['a.somedomain.tld', 'b.anotherdomain.tld'],
        '##channel2': ['some/other/hostmask'],
        }

    # Enable raw logging of everything jenni sees.
    # logged to the folder 'log'
    logging = False

    # Block modules from specific channels
    # To not block anything for a channel, just don't mention it
    excludes = {
            '##blacklist': ['!'],
        }

    # If you want to enumerate a list of modules rather than disabling
    # some, use "enable = ['example']", which takes precedent over exclude
    #
    # enable = []

    # Directories to load user modules from
    # e.g. /path/to/my/modules
    extra = ['""" + os.getcwd() + '/modules/' + """']

    # Services to load: maps channel names to white or black lists
    external = {
        '#liberal': ['!'], # allow all
        '#conservative': [], # allow none
        '*': ['!'] # default whitelist, allow all
    }

    # insult database available: "spanish" and "english"
    insult_lang = "english"

    # EOF
    """
    print(trim(output), file=f)
    f.close()
Esempio n. 12
0
    def write(self):
        """
        Writes the current configuration to the file from which the current
        configuration is derived. Changes made through ``set_attr`` may not be
        properly written by this function.
        """
        f = open(self.filename, 'w')
        
        if hasattr(self, 'password') and self.password:
            password_line = "password = '******'"
        else:
            password_line = "# password = '******'"
        if hasattr(self, 'serverpass') and self.serverpass:
            serverpass_line = "serverpass = '******'"
        else:
            serverpass_line = "# serverpass = '******'"
        if hasattr(self, 'enable') and self.enable:
            enable_line = "enable = "+str(self.enable)
        else:
            enable_line = "# enable = []"
        extra = self.extra.append(os.getcwd() + '/modules/')
        
        output = trim("""\
        nick = '"""+self.nick+"""'
        host = '"""+self.host+"""'
        port = """+str(self.port)+"""
        channels = """+str(self.channels)+"""
        owner = '"""+self.owner+"""'
        
        # Channel where debug messages should be sent.
        debug_target = '"""+self.debug_target+"""'
        
        # Verbosity level for debug messages.
        verbose = '"""+self.verbose+"""'
        
        # List of other bots, whose outputs should be ignored
        other_bots = """+str(self.other_bots)+"""

        # password is the NickServ password, serverpass is the server password
        """+password_line+"""
        """+serverpass_line+"""
        
        # The oper name and password, if the bot is allowed to /oper
        """+self.operline+"""

        # These are people who will be able to use admin.py's functions...
        admins = """+str(self.admins)+"""
        # But admin.py is disabled by default, as follows:
        exclude = """+str(self.exclude)+"""

        # If you want to enumerate a list of modules rather than disabling
        # some, use "enable = ['example']", which takes precedent over exclude
        #
        """+enable_line+"""
        
        # Directories to load user modules from
        # e.g. /path/to/my/modules
        extra = """+str(extra)+"""

        # Services to load: maps channel names to white or black lists
        # 
        # ?? Doesn't seem to do anything?
        # external = {
        #    '#liberal': ['!'], # allow all
        #    '#conservative': [], # allow none
        #    '*': ['!'] # default whitelist, allow all
        #}
        """)+(self.settings_chunk+trim("""

        #-----------------------MODULE  SETTINGS-----------------------

        """)+self.modules_chunk)+trim("""
        
        # EOF
        """)
        print >> f, output
        f.close()
Esempio n. 13
0
def create_default_config(fn):
    f = open(fn, 'w')
    output = """\
    # Lines that begin with a "#" are comments.
    # Remove the "#" from the beginning of a line to make those lines active.

    nick = 'jenni'
    host = 'irc.example.net'
    port = 6667
    ssl  = False
    sasl = False
    channels = ['#example', '#test']

    # Channel jenni will report all private messages sent to her to.
    # This includes server notices.
    # logchan_pm = '#jenni-log'

    # You can also specify nick@hostmask
    # For example: yano@unaffiliated/yano
    owner = 'yournickname'

    # user is the NickServ userid
    # This is useful if your NickServ user is different than the nick you are using
    # user = '******'

    # password is the NickServ password, serverpass is the server password
    # password = '******'
    # serverpass = '******'


    ## API KEYS

    # forecastio_apikey is for an API key from https://forecast.io/
    # This is useful if you want extended weather information.
    # Required if you want .weather to work.
    # If not, you can use .weather-noaa or .wx-noaa
    # forecastio_apikey = ''

    # wunderground_apikey is for an API key from http://www.wunderground.com/
    # This is useful if you want more local and *live* weather information.
    # This is optional and doesn't need to be added.
    # wunderground_apikey = ''

    # google_dev_apikey is for an API key from Google Developers
    # https://developers.google.com/api-client-library/python/guide/aaa_apikeys
    # Get a Server API Key; this is required for YouTube to work.
    # google_dev_apikey = ''

    # wolframalpha_apikey is for an API key from Wolfram|Alpha
    # http://products.wolframalpha.com/api/
    # This is needed in order to make .calc/.c have more comprehensive answers.
    # wolframalpha_apikey = ''


    # twitter_consumer_key and twitter_consumer_secret are for Twitter's API
    # https://apps.twitter.com/
    # This is needed if you'd like to make .twitter usable
    # twitter_consumer_key = ''
    # twitter_consumer_secret = ''

    # Fill in Yelp API information here
    # This is for using the .food command
    yelp_api_credentials = {
        'consumer_key': '',
        'consumer_secret': '',
        'token': '',
        'token_secret': ''
        }

    # api.ai https://docs.api.ai/docs/get-started

    # apiai_apikey = ''

    # google custom search
    # https://developers.google.com/custom-search/
    # http://stackoverflow.com/a/5615931

    # cse_apikey = ''
    # cse_appid = ''


    # openweathermap
    # owm_apikey = ''

    # You can add bannable words / regex per channel
    # bad_words = {
    #   "#yourchan": ['badword', '(a|b).*c.*(d|e)']
    # }
    #
    # This controls the number of warnings a user will receive
    # before they are banned from the channel
    # bad_word_limit = 1

    # auto_title_disable_chans is for disabling the auto URL title feature
    # simply add a channel to this list (preferably in all lower-case)
    # and it won't auto-title URLs in that channel, but .title and other features
    # will still work
    # auto_title_disable_chans = ['##yano',]

    # These are people who will be able to use admin.py's functions...
    admins = [owner, 'someoneyoutrust']
    # But admin.py is disabled by default, as follows:
    exclude = ['adminchannel', 'chicken_reply', 'insult', 'lispy', 'twss']

    # This allows one to allow specific people to use ".msg channel message here"
    # in specific channels.
    helpers = {
        '#channel1': ['a.somedomain.tld', 'b.anotherdomain.tld'],
        '##channel2': ['some/other/hostmask'],
        }

    # Enable raw logging of everything jenni sees.
    # logged to the folder 'log'
    logging = False

    # Block modules from specific channels
    # To not block anything for a channel, just don't mention it
    excludes = {
            '##blacklist': ['!'],
        }

    # If you want to enumerate a list of modules rather than disabling
    # some, use "enable = ['example']", which takes precedent over exclude
    #
    # enable = []

    # Directories to load user modules from
    # e.g. /path/to/my/modules
    extra = ['""" + os.getcwd() + '/modules/' + """']

    # Services to load: maps channel names to white or black lists
    external = {
        '#liberal': ['!'], # allow all
        '#conservative': [], # allow none
        '*': ['!'] # default whitelist, allow all
    }

    # insult database available: "spanish" and "english"
    insult_lang = "english"

    # EOF
    """
    print(trim(output), file=f)
    f.close()