Beispiel #1
0
def configure(settings: Config):
    """
    | name | example | purpose |
    | ---- | ------- | ------- |
    | default\\_mode | on | Which mode to use in channels without a mode set. |
    | known\\_good | sopel.chat,dftba.net | List of "known good" domains or regexes to consider trusted. This can save VT API calls. |
    | vt\\_api\\_key | 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef | Optional VirusTotal API key to improve malicious URL detection |
    | domain\\_blocklist\\_url | https://example.com/bad-hosts.txt | Optional hosts-file formatted domain blocklist to use instead of StevenBlack's. |
    """
    settings.define_section("safety", SafetySection)
    settings.safety.configure_setting(
        "default_mode",
        ("Which mode should be used in channels that haven't specifically set one?"
         "\n({})".format("/".join(SAFETY_MODES))),
        default="on",
    )
    settings.safety.configure_setting(
        'known_good',
        "Enter any domains or regexes to consider trusted",
    )
    settings.safety.configure_setting(
        'vt_api_key',
        "Optionally, enter a VirusTotal API key to improve malicious URL "
        "protection.\nOtherwise, only the configured hosts list will be used.",
    )
    settings.safety.configure_setting(
        "domain_blocklist_url",
        "Optionally, provide the URL for a hosts-file formatted domain "
        "blocklist to use instead of StevenBlack's.",
    )
Beispiel #2
0
def configure(config: Config):
    """
    | name | example | purpose |
    | ---- | ------- | ------- |
    | enable_auto_title | yes | Enable auto-title. |
    | exclude | https?://git\\\\.io/.* | A list of regular expressions for URLs for which the title should not be shown. |
    | exclusion\\_char | ! | A character (or string) which, when immediately preceding a URL, will stop the URL's title from being shown. |
    | shorten\\_url\\_length | 72 | If greater than 0, the title fetcher will include a TinyURL version of links longer than this many characters. |
    | enable\\_private\\_resolution | False | Enable requests to private and local network IP addresses. |
    """
    config.define_section('url', UrlSection)
    config.url.configure_setting('enable_auto_title', 'Enable auto-title?')
    config.url.configure_setting(
        'exclude',
        'Enter regular expressions for each URL you would like to exclude.')
    config.url.configure_setting(
        'exclusion_char',
        'Enter a character which can be prefixed to suppress URL titling')
    config.url.configure_setting(
        'shorten_url_length',
        'Enter how many characters a URL should be before the bot puts a'
        ' shorter version of the URL in the title as a TinyURL link'
        ' (0 to disable)')
    config.url.configure_setting(
        'enable_private_resolution',
        'Enable requests to private and local network IP addresses?')