Action_Beleidigend.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from hermes_python.ontology import *
  4. from hermes_python.hermes import Hermes
  5. import random
  6. import Action_Base
  7. @Action_Base.Snips("Beleidigend","insult")
  8. class Action_Beleidigend(Action_Base.Action_Base):
  9. def getMessage(self, intent_message):
  10. if len(intent_message.slots)>0:
  11. multiplier=1.0
  12. bel1=""
  13. bel2=""
  14. if intent_message is not None:
  15. if intent_message.slots.Beleidigung != None and len(intent_message.slots.Beleidigung)>0:
  16. bel = str(intent_message.slots.Beleidigung.first().value)
  17. if intent_message.slots.Beleidigung2 != None and len(intent_message.slots.Beleidigung2)>0:
  18. bel1 = str(intent_message.slots.Beleidigung2.first().value)
  19. if intent_message.slots.Multiplier != None and len(intent_message.slots.Multiplier)>0:
  20. multiplier+=0.35
  21. if intent_message.slots.Multiplier2 != None and len(intent_message.slots.Multiplier2)>0:
  22. multiplier+=0.2
  23. if(bel=="heavyRude"):
  24. self.common.modState("angry", 250 * multiplier)
  25. self.common.modState("happyness", -250 * multiplier)
  26. self.common.modState("depresive", 22*multiplier)
  27. elif(bel=="softRude"):
  28. self.common.modState("angry", 50 * multiplier)
  29. self.common.modState("happyness", -20 * multiplier)
  30. self.common.modState("depresive", 22*multiplier)
  31. else:
  32. self.common.modState("angry", 100 * multiplier)
  33. self.common.modState("happyness", -90 * multiplier)
  34. self.common.modState("depresive", 22*multiplier)
  35. if(bel2=="heavyRude"):
  36. self.common.modState("angry", 100 * multiplier)
  37. self.common.modState("happyness", -100 * multiplier)
  38. self.common.modState("depresive", 22*multiplier)
  39. elif(bel2=="softRude"):
  40. self.common.modState("angry", 30 * multiplier)
  41. self.common.modState("happyness", -10 * multiplier)
  42. self.common.modState("depresive", 10*multiplier)
  43. else:
  44. self.common.modState("angry", 80 * multiplier)
  45. self.common.modState("happyness", -30 * multiplier)
  46. self.common.modState("depresive", 14*multiplier)
  47. return self.getMoodMessage()