Example #1
0

def make_folders():
    if not os.path.exists(main_dir):
        os.makedirs(main_dir)

    if not os.path.exists(temp_dir):
        os.makedirs(temp_dir)


make_folders()

print('Loading Chatbot-RNN...')
save, load, reset, change_settings, consumer = libchatbot(
    temperature=temperature,
    relevance=relevance,
    topn=topn,
    max_length=max_length)
print('Chatbot-RNN has been loaded.')


def save_last_message():
    global last_message
    with open(last_message_file + '.pkl', 'wb') as f:
        pickle.dump(last_message, f)


def load_last_message():
    global last_message
    with open(last_message_file + '.pkl', 'rb') as f:
        last_message = pickle.load(f)
from chatbot import libchatbot
import discord
import asyncio

logName = "Discord-Bot_Session.log"
logFile = open(logName, "a")

print('Loading Chatbot-RNN...')
consumer = libchatbot()
# consumer("Hi")
print('Chatbot-RNN has been loaded.')

print('Preparing Discord Bot...')
client = discord.Client()


@client.event
async def on_ready():
    print()
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print()
    print('Discord Bot ready!')


@client.event
async def on_message(message):
    if message.content.startswith('>'):
        msgContent = ''
        if message.content.startswith('> '):
Example #3
0
try:  # Unicode patch for Windows
    import win_unicode_console
    win_unicode_console.enable()
except:
    msg = "Please install the 'win_unicode_console' module."
    if os.name == 'nt': print(msg)

log_name = "Discord-Bot_Session.log"
log_file = open(log_name, "a", encoding="utf-8")

states_file = "general"
autosave = True
operators = ['Discord User IDs Here']

print('Loading Chatbot-RNN...')
save, load, reset, consumer = libchatbot()
if os.path.exists(states_file + ".pkl") and os.path.isfile(states_file +
                                                           ".pkl"):
    load(states_file)
    print('Loaded pre-existing Chatbot-RNN states.')
print('Chatbot-RNN has been loaded.')

print('Preparing Discord Bot...')
client = discord.Client()


@client.event
async def on_ready():
    print()
    print('Logged in as')
    print(client.user.name)
Example #4
0
operators_file = user_settings_folder + "/" + "operators.cfg"
banned_users_file = user_settings_folder + "/" + "banned_users.cfg"

processing_users = {}

mention_in_message = True
mention_message_separator = " - "

ult_operators = []
operators = []
banned_users = []

states_queue = {}

print('Loading Chatbot-RNN...')
save, load, get, get_current, reset, consumer = libchatbot(
    max_length=max_length)
print('Chatbot-RNN has been loaded.')

print('Preparing Discord Bot...')
client = discord.Client()


@client.event
async def on_ready():
    print()
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print()
    print('Discord Bot ready!')
Example #5
0
mention_in_message = True
mention_message_separator = " - "

message_prefix = ">"
command_prefix = "--"  # Bascially treated as message_prefix + command_prefix

ult_operators = []
operators = []
banned_users = []

states_queue = {}

print('Loading Chatbot-RNN...')
lib_save_states, lib_load_states, lib_get_states, lib_get_current_states, lib_reset_states, change_settings, consumer = libchatbot(
    save_dir=save_dir,
    max_length=max_length,
    temperature=temperature,
    relevance=relevance,
    topn=topn)
print('Chatbot-RNN has been loaded.')

print('Preparing Discord Bot...')
client = discord.Client()


@client.event
async def on_ready():
    print()
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print()
Example #6
0
processing_users = []

mention_in_message = True
mention_message_separator = " - "

message_prefix = ">"
command_prefix = "--"  # Basically treated as message_prefix + command_prefix

ult_operators = []
operators = []
banned_users = []

states_queue = {}

print('Loading Chatbot-RNN...')
lib_save_states, lib_get_states, consumer = libchatbot(save_dir=save_dir,
                                                       max_length=max_length)
print('Chatbot-RNN has been loaded.')

print('Preparing Discord Bot...')
client = discord.Client()


@client.event
async def on_ready():
    print()
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print()
    print('Discord Bot ready!')
log_name = "Discord-Bot_Session.log"
log_file = open(log_name, "a", encoding="utf-8")

states_main = "states"
states_folder = states_main + "/" + "server_states"
states_folder_dm = states_main + "/" + "dm_states"

autosave = True
autoload = True
operators = ['']; # ID Tags
banned_users = ['']; # ID Tags
max_length = 500

print('Loading Chatbot-RNN...')
save, load, reset, consumer = libchatbot(max_length=max_length)
print('Chatbot-RNN has been loaded.')

print('Preparing Discord Bot...')
client = discord.Client()

@client.event
async def on_ready():
    print()
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print()
    print('Discord Bot ready!')

async def load_channel_states(channel):