Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
F
fantasary
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
spritely
fantasary
Commits
b73030d5
Commit
b73030d5
authored
1 year ago
by
David Thompson
Browse files
Options
Downloads
Patches
Plain Diff
Add simple barista bot.
parent
73877db6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fantasary/server.scm
+32
-3
32 additions, 3 deletions
fantasary/server.scm
with
32 additions
and
3 deletions
fantasary/server.scm
+
32
−
3
View file @
b73030d5
...
...
@@ -77,19 +77,19 @@
(
profile
(
spawn
^profile
identity
))
(
entity
(
spawn
^entity
profile
))
(
controller
(
spawn
^controller
hub
entity
))
(
event-handler
(
spawn
^event-handler
controller
))
(
event-handler
(
spawn
^event-handler
profile
controller
))
(
bot
(
make-bot
identity
profile
entity
controller
)))
(
$
entity
'set-event-handler
event-handler
)
(
<-np
controller
'enter
room
)
(
add-bot!
scheme-name
bot
))))
(
define
(
^dice-roller
_bcom
controller
)
(
define
(
^dice-roller
_bcom
_profile
controller
)
(
match-lambda
((
'direct
from
'roll-dice
)
(
let-on
((
from-profile
(
<-
from
'profile
)))
(
let
((
roll-1
(
+
(
random
6
)
1
))
(
roll-2
(
+
(
random
6
)
1
)))
(
<-np
controller
'emote
"rolls the dice"
)
(
<-np
controller
'emote
"rolls the dice
.
"
)
(
<-np
controller
'say
(
list
from-profile
" rolled a "
roll-1
" and a "
roll-2
"."
)))))
((
'direct
from
args
...
)
...
...
@@ -98,6 +98,34 @@
from-profile
". Try 'roll-dice'."
))))
(
_
#f
)))
(
define
(
^barista
_bcom
profile
controller
)
(
match-lambda
((
'direct
from
'talk
)
(
let-on
((
from-profile
(
<-
from
'profile
)))
(
<-np
controller
'emote
(
list
"notices "
from-profile
" approach the counter."
))
(
<-np
controller
'say
(
list
"Hello, "
from-profile
". What would you like to order today?"
))
(
<-np
controller
'say
(
list
"We have coffee or tea. We're a simple shop."
))))
((
'direct
from
'order
item
)
(
let-on
((
from-profile
(
<-
from
'profile
)))
(
let
((
name
(
match
item
((
or
'coffee
'Coffee
'COFFEE
"coffee"
"Coffee"
"COFFEE"
)
"coffee"
)
((
or
'tea
'Tea
'TEA
"tea"
"Tea"
"TEA"
)
"tea"
)
(
_
#f
))))
(
if
name
(
begin
(
<-np
controller
'say
(
list
"One "
name
" for "
from-profile
" coming right up!"
))
(
<-np
controller
'emote
(
list
"hands "
from-profile
" a piping hot cup of "
name
"."
))
(
<-np
controller
'say
"Too bad we don't have inventory implemented or you could take that with you."
))
(
<-np
controller
'say
(
list
"Sorry "
from-profile
", we don't have that."
))))))
(
_
#f
)))
(
define
(
run-server
port
)
(
format
#t
"Generating TLS certs (if not present)\n"
)
(
generate-tls-cert-maybe!
tls-key-file-name
tls-cert-file-name
)
...
...
@@ -116,6 +144,7 @@
(
spawn
^hub
lobby
)))
(
format
#t
"Spawning bots\n"
)
(
spawn-bot!
'dice-roller
"DiceRoller"
^dice-roller
hub
lobby
)
(
spawn-bot!
'barista
"Barista"
^barista
hub
cafe
)
(
format
#t
"Spawning OCapN\n"
)
(
define
tcp-netlayer
(
with-vat
machine-vat
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment