-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.py
50 lines (44 loc) · 1.79 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
###
# Copyright (c) 2016, lod
# All rights reserved.
#
#
###
import supybot.conf as conf
import supybot.registry as registry
try:
from supybot.i18n import PluginInternationalization
_ = PluginInternationalization('Searx')
except:
# Placeholder that allows to run the plugin on a bot
# without the i18n module
_ = lambda x: x
def configure(advanced):
# This will be called by supybot to configure this module. advanced is
# a bool that specifies whether the user identified themself as an advanced
# user or not. You should effect your configuration by manipulating the
# registry as appropriate.
from supybot.questions import expect, anything, something, yn
conf.registerPlugin('Searx', True)
class NumSearchResults(registry.PositiveInteger):
"""Value must be 1 <= n <= 8"""
def setValue(self, v):
if v > 8:
self.error()
super(self.__class__, self).setValue(v)
Searx = conf.registerPlugin('Searx')
conf.registerChannelValue(Searx, 'url',
registry.String('https://searx.me/', _("""Determines the URL used for
requests.""")))
conf.registerChannelValue(Searx, 'bold',
registry.Boolean(True, _("""Determines whether results are bolded.""")))
conf.registerChannelValue(Searx, 'oneToOne',
registry.Boolean(False, _("""Determines whether results are sent in
different lines or all in the same one.""")))
conf.registerChannelValue(Searx, 'maximumResults',
NumSearchResults(3, _("""Determines the maximum number of results returned
from the google command.""")))
conf.registerChannelValue(Searx, 'defaultLanguage',
registry.String('all', _("""Determines what default language is used in
searches. If left empty, no specific language will be requested.""")))
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: