Add 8ball command
This commit is contained in:
parent
18f56be754
commit
faa62604ef
2 changed files with 44 additions and 2 deletions
|
@ -8,8 +8,49 @@ module Chronicle
|
|||
# @param message [Message object] The relevant message object
|
||||
def handle_ping(client, message)
|
||||
room = client.ensure_room message.room_id
|
||||
|
||||
|
||||
room.send_notice('Pong!')
|
||||
end
|
||||
|
||||
# 8-Ball: Give a random, vague response to a question
|
||||
#
|
||||
# @param client [Client object] The current Matrix client connection
|
||||
# @param message [Message object] The relevant message object
|
||||
def handle_8ball(client, message)
|
||||
msgstr = message.content[:body]
|
||||
.gsub(/!8ball\s*/, '')
|
||||
.strip
|
||||
|
||||
room = client.ensure_room(message.room_id)
|
||||
|
||||
fates = [
|
||||
'Resoundingly, yes.',
|
||||
'Chances are good.',
|
||||
'Signs point to yes.',
|
||||
'Wheel.',
|
||||
'It is worth the attempt.',
|
||||
'Uncertainty clouds my sight.',
|
||||
'Wheel and woe.',
|
||||
'Neither wheel nor woe.',
|
||||
'Concentrate, and ask again.',
|
||||
'I cannot say for sure.',
|
||||
'The fates do not know.',
|
||||
"Why are you asking me? I'm just a bot.",
|
||||
'Error: Fate API returned 404. Try again later.',
|
||||
'Woe.',
|
||||
'Chances are poor.',
|
||||
'Signs point to no.',
|
||||
'Very doubtful.',
|
||||
'Absolutely no.'
|
||||
]
|
||||
|
||||
res = if msgstr[-1] == '?'
|
||||
fates.sample
|
||||
else
|
||||
'You must ask a question. Try again'
|
||||
end
|
||||
|
||||
room.send_notice(res)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue