Ejemplo n.º 1
0
def load(parent_location):
    global bot_token, discord_playing, owner_ids, command_alias, discord_channels, discord_learn_channels, chat_to_console

    config.read(parent_location + '/config/defaults.cfg')
    config.read(parent_location + '/config/config.cfg')

    if config.has_section('Discord'):
        command_alias = config.get('Discord', 'command_alias')
        bot_token = config.get('Discord', 'token')
        discord_playing = config.get('Discord', 'playing')

        for owner in config.get('Discord', 'owner_ids').split(','):
            owner_ids.append(owner.strip())

            chat_to_console = common.set_boolean(
                config.get('Discord', 'chat-to-console'))

        for channel in config.get('Discord', 'channels').split(','):
            discord_channels.append(channel.strip())

        for channel in config.get('Discord', 'markov-channels').split(','):
            discord_markov_channels.append(channel.strip())

        markov_learn_pm = common.set_boolean(
            config.get('Markov', 'markov_learn_pm'))
Ejemplo n.º 2
0
import time
import importlib
import importlib.util
import re
import os
import datetime

version = '0.9.3.7'

script_location = os.path.dirname(os.path.abspath(__file__))
config = SafeConfigParser(allow_no_value=True)
config.read(script_location + '/config/defaults.cfg')
config.read(script_location + '/config/config.cfg')

markov = None
use_discord_client = common.set_boolean(
    config.get('Config', 'use_discord_client'))
use_markov = common.set_boolean(config.get('Config', 'use_markov'))
chat_client = None
derpy_stats = None
client_thread = None
status_thread = None
shutting_down = False
console_prefix = "[DerpyBot] "


def commands():
    common.console_print("Entering command mode...", console_prefix)

    while not shutting_down:
        command = input('>> ')
Ejemplo n.º 3
0
script_location = os.path.dirname(os.path.abspath(__file__))

config = SafeConfigParser()
config.read(script_location + '/config/defaults.cfg')
config.read(script_location + '/config/config.cfg')

if config.has_section('General'):
    dictionary_directory = config.get('General', 'dictionary_directory')
    absolute_dictionary_directory = script_location + '/' + dictionary_directory
    main_dictionary_filename = config.get('General', 'main_dictionary_file')
    main_dictionary_file = absolute_dictionary_directory + '/' + main_dictionary_filename
    supplementary_text_filename = config.get('General', 'supplementary_text_file')
    supplementary_text_file = dictionary_directory + '/' + supplementary_text_filename
    state_size1 = int(config.get('General', 'state_size'))
    learn = common.set_boolean(config.get('General', 'learn'))
    save_interval = int(config.get('General', 'save_interval'))
    update_stats_on_learn = common.set_boolean(config.get('General', 'update_stats_on_learn'))

if config.has_section('Reply'):
    reply_rate = float(config.get('Reply', 'reply_rate'))
    bot_name_reply_rate = float(config.get('Reply', 'bot_name_reply_rate'))
    reply_queue = common.set_boolean(config.get('Reply', 'reply_queue'))

if config.has_section('Sentence'):
    sentence_max_words = int(config.get('Sentence', 'sentence_max_words'))
    test_output = common.set_boolean(config.get('Sentence', 'test_output'))
    use_keywords = common.set_boolean(config.get('Sentence', 'use_keywords'))
    try_all_words_for_key = common.set_boolean(config.get('Sentence', 'try_all_words_for_key'))
    sentence_with_key_tries = int(config.get('Sentence', 'sentence_with_key_tries'))
    max_overlap_ratio = float(config.get('Sentence', 'max_overlap_ratio'))