Package org.vrspace.server.obj
Class Bot
java.lang.Object
org.vrspace.server.obj.Entity
org.vrspace.server.obj.VRObject
org.vrspace.server.obj.Client
org.vrspace.server.obj.User
org.vrspace.server.obj.Bot
A Bot is a Client that has no session. It does have own scene, and observes all events in the scene. It also responds to
something that user(s) write. Bots are configured in application.properties file, and instantiated by BotManager on server
startup.
- Author:
- joe
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanNames of available avatar animations.Passed to the Bot on creationGender is advice for client, e.g.getLang()Bot language, e.g.getParameter(String key) Returns a parameter from parameter mapConfigured bot parameters parameters, available through getParameter() method, not publishedgetRange()abstract reactor.core.publisher.Mono<String> getResponseAsync(Client c, String query) Response generation method that subclasses need to override.getUrl()Configured URL of chatbot server, not publishedPassed to the Bot on creation, as Bots may need access to the database or other WorldManager methodsinthashCode()booleanisAsync()booleanbooleanbooleanbooleanvoidobjectsAdded(List<VRObject> objects) New objects in the scene, typically a client that has arrived.voidobjectsRemoved(List<Map<String, String>> objects) Objects removed from the scene, typically a client that has left.voidprocessEvent(VREvent event) Process an event.voidGet response to something that a client "said", and write it.abstract voidselfTest()Self test runs on server startup.voidScene management method, called when the scene changes.voidsetAnimations(List<String> animations) Names of available avatar animations.voidsetAsync(boolean async) voidsetBotManager(BotManager botManager) Passed to the Bot on creationvoidGender is advice for client, e.g.voidBot language, e.g.voidsetParameterMap(Map<String, String> parameterMap) Configured bot parameters parameters, available through getParameter() method, not publishedvoidsetProcessing(boolean processing) voidsetQueryCleanup(Pattern queryCleanup) voidvoidsetResponding(boolean responding) voidsetRespondToBots(boolean respondToBots) voidsetShouldRespond(boolean shouldRespond) voidConfigured URL of chatbot server, not publishedvoidsetWorldManager(WorldManager worldManager) Passed to the Bot on creation, as Bots may need access to the database or other WorldManager methodstoString()voidUtility method - "say" something, notify all listeners.Methods inherited from class org.vrspace.server.obj.User
createScene, getLeftArmPos, getLeftArmRot, getOauth2provider, getRightArmPos, getRightArmRot, isHumanoid, isVideo, setHumanoid, setLeftArmPos, setLeftArmRot, setOauth2provider, setRightArmPos, setRightArmRot, setVideoMethods inherited from class org.vrspace.server.obj.Client
clearToken, getIdentity, getMapper, getName, getPicture, getPrivateMapper, getScene, getSceneProperties, getSession, getToken, getTokens, getUserHeight, getWriteBack, isGuest, setGuest, setIdentity, setMapper, setName, setPicture, setPrivateMapper, setScene, setSceneProperties, setSession, setToken, setTokens, setUserHeight, setWriteBackMethods inherited from class org.vrspace.server.obj.VRObject
active, addChildren, addListener, getActive, getAnimation, getChildren, getListeners, getMesh, getPermanent, getPosition, getProperties, getRotation, getScale, getScript, getTemporary, getWorld, getWorldId, isActive, isDeleted, isPermanent, isTemporary, notifyListeners, passive, removeListener, setActive, setAnimation, setChildren, setDeleted, setListeners, setMesh, setPermanent, setPosition, setProperties, setRotation, setScale, setScript, setTemporary, setWorld, setWorldIdMethods inherited from class org.vrspace.server.obj.Entity
dispose, getId, getObjectId, setId
-
Field Details
-
processing
protected volatile boolean processing
-
-
Constructor Details
-
Bot
public Bot()
-
-
Method Details
-
getParameter
Returns a parameter from parameter map -
selfTest
Self test runs on server startup. Exceptions are logged but otherwise ignored.- Throws:
Exception
-
getResponseAsync
Response generation method that subclasses need to override.- Parameters:
c- Client sending the query, typically User instance, may be Bot if respondToBots is true.query- Whatever user wrote.- Returns:
- Mono that evaluates to the answer.
-
respondTo
Get response to something that a client "said", and write it. If the client is a Bot instance, respond only if respondToBots is true. Also takes into account bot range, and ignores if client out of range. Calls getResponseAsync method, and then write if it returns anything. Errors are ignored, assuming getResponseAsync handles and logs them. -
write
Utility method - "say" something, notify all listeners. Null and empty argument is silently ignored, as in no response from the bot. -
processEvent
Process an event. If that's something that a user/bot wrote, calls respondTo method. Other events are ignored.- Overrides:
processEventin classClient- Parameters:
event- Whatever has changed
-
objectsAdded
New objects in the scene, typically a client that has arrived. This implementation sets responding flag to true, to ensure bots don't stay silent forever. -
objectsRemoved
Objects removed from the scene, typically a client that has left. This implementation does nothing, utility method for subclasses. -
sendMessage
Scene management method, called when the scene changes.- Overrides:
sendMessagein classClient
-
toString
-
getGender
Gender is advice for client, e.g. voice synthesis -
getLang
Bot language, e.g. in case it can speak more than one -
getUrl
Configured URL of chatbot server, not published -
getParameterMap
Configured bot parameters parameters, available through getParameter() method, not published -
getAnimations
Names of available avatar animations. The list is loaded from content/rpm-anim directory, if loadAnimations is set. It can be configured and set for each bot separatelly. Hint for the bot itself, not published. -
getWorldManager
Passed to the Bot on creation, as Bots may need access to the database or other WorldManager methods -
getBotManager
Passed to the Bot on creation -
isRespondToBots
public boolean isRespondToBots() -
isAsync
public boolean isAsync() -
getRange
-
isProcessing
public boolean isProcessing() -
isResponding
public boolean isResponding() -
isShouldRespond
public boolean isShouldRespond() -
getQueryCleanup
-
setGender
Gender is advice for client, e.g. voice synthesis -
setLang
Bot language, e.g. in case it can speak more than one -
setUrl
Configured URL of chatbot server, not published -
setParameterMap
Configured bot parameters parameters, available through getParameter() method, not published -
setAnimations
Names of available avatar animations. The list is loaded from content/rpm-anim directory, if loadAnimations is set. It can be configured and set for each bot separatelly. Hint for the bot itself, not published. -
setWorldManager
Passed to the Bot on creation, as Bots may need access to the database or other WorldManager methods -
setBotManager
Passed to the Bot on creation -
setRespondToBots
public void setRespondToBots(boolean respondToBots) -
setAsync
public void setAsync(boolean async) -
setRange
-
setProcessing
public void setProcessing(boolean processing) -
setResponding
public void setResponding(boolean responding) -
setShouldRespond
public void setShouldRespond(boolean shouldRespond) -
setQueryCleanup
-
equals
-
canEqual
-
hashCode
public int hashCode()
-