configurable gender

This commit is contained in:
deathbybandaid 2019-06-05 08:31:52 -04:00
parent 80eb810238
commit 4380aeb6cf
3 changed files with 5 additions and 2 deletions

View File

@ -5,7 +5,7 @@ This is the SpiceBot AI system. Based On Chatty cathy
""" """
from sopel.tools import Identifier from sopel.tools import Identifier
from sopel.config.types import StaticSection, ListAttribute from sopel.config.types import StaticSection, ListAttribute, ValidatedAttribute
import os import os
import tempfile import tempfile
@ -17,6 +17,7 @@ from .Config import config as botconfig
class SpiceBot_AI_MainSection(StaticSection): class SpiceBot_AI_MainSection(StaticSection):
extra = ListAttribute('extra') extra = ListAttribute('extra')
gender = ValidatedAttribute('gender', default='female')
class SpiceBot_AI(): class SpiceBot_AI():
@ -61,6 +62,7 @@ class SpiceBot_AI():
def load_bot_values(self, bot): def load_bot_values(self, bot):
self.aiml_kernel.setBotPredicate("nick", bot.nick) self.aiml_kernel.setBotPredicate("nick", bot.nick)
self.aiml_kernel.setBotPredicate("gender", bot.config.SpiceBot_AI.gender)
def load_extras(self, bot): def load_extras(self, bot):
if len(bot.config.SpiceBot_AI.extra): if len(bot.config.SpiceBot_AI.extra):

View File

@ -35,3 +35,4 @@ def configure(config):
config.define_section("SpiceBot_AI", SpiceBot_AI_MainSection, validate=False) config.define_section("SpiceBot_AI", SpiceBot_AI_MainSection, validate=False)
config.SpiceBot_AI.configure_setting('extra', 'extra aiml directories to import matches from') config.SpiceBot_AI.configure_setting('extra', 'extra aiml directories to import matches from')
config.SpiceBot_AI.configure_setting('gender', 'bot gender')

View File

@ -9,7 +9,7 @@
<category> <category>
<pattern>BOTNICK WHAT IS YOUR GENDER</pattern> <pattern>BOTNICK WHAT IS YOUR GENDER</pattern>
<template>If societal genders are binary, my gender is female</template> <template>If societal genders are binary, my gender is <bot name="gender"/></template>
</category> </category>