Browse files

Added chatbot

  • Loading branch information...
1 parent 781ce4f commit 9a063c0d6f254237c4188762cdfe3cf7cffb1422 Daniel Hobi committed Jan 28, 2014
Showing with 32 additions and 0 deletions.
  1. +4 −0 src/main/scala/bootstrap/liftweb/Boot.scala
  2. +28 −0 src/main/scala/code/comet/ChatBot.scala
View
4 src/main/scala/bootstrap/liftweb/Boot.scala
@@ -10,6 +10,7 @@ import sitemap._
import Loc._
import net.liftmodules.JQueryModule
import net.liftweb.http.js.jquery._
+import code.comet.ChatBot
/**
@@ -54,5 +55,8 @@ class Boot {
JQueryModule.InitParam.JQuery=JQueryModule.JQuery172
JQueryModule.init()
+ //init that bot once
+ new ChatBot
+
}
}
View
28 src/main/scala/code/comet/ChatBot.scala
@@ -0,0 +1,28 @@
+package code.comet
+
+import net.liftweb.common.Full
+import code.util.Coords
+import net.liftweb.util.Schedule
+import net.liftweb.util.Helpers._
+
+class ChatBot extends ChatUser {
+
+ this.coords = Full(Coords(9.193994113713475,-150.47119175000006))
+ this.color = "#00B7FF"
+
+ private def init() {
+ ChatServer ! NewConnection(this)
+ Schedule.schedule(sayLiftWeb, 0)
+ }
+
+ private def sayLiftWeb() {
+ ChatServer ! Message(this, "http://www.liftweb.net/")
+ Schedule.schedule(sayLiftWeb, 60 seconds)
+ }
+
+ override def lowPriority = {
+ case _ => //gulp
+ }
+
+ init()
+}

0 comments on commit 9a063c0

Please sign in to comment.