unexist.dev

Changeset 57:2ee7102f5580

Added isitfriday plugin
author unexist
date Mon, 06 Aug 2018 14:39:18 +0200
parents 059081b9c7c5
children a53b371271fc
files slack/slack.rb
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/slack/slack.rb	Fri Aug 03 15:59:06 2018 +0200
+++ b/slack/slack.rb	Mon Aug 06 14:39:18 2018 +0200
@@ -128,6 +128,20 @@
   end
 end # }}}
 
+# Isitfriday handler
+
+def isitfriday(nick) # {{{
+  wday = Time.now.strftime("%A")
+
+  key = "weekday"
+
+  if "Friday" == wday
+    key = "weekend"
+  end
+
+  get_phrase(nick, "", "!", key, nil)
+end # }}}
+
 # Weather handler
 
 def weather(nick, location) #{{{
@@ -525,6 +539,7 @@
 # Message Regexp
 
 REGEXP = [
+  { match: /^!isitfriday$/, method: :isitfriday },
   { match: /^!weather (.+)$/, method: :weather },
   { match: /^!commit$/, method: :commit },
   { match: /^!proto$/, method: :protolol },