bin/bot in boty-0.0.15 vs bin/bot in boty-0.0.16
- old
+ new
@@ -1,14 +1,22 @@
#!/usr/bin/env ruby
require "./lib/boty"
+def set_locale(locale)
+ begin
+ Boty.locale = locale || :en
+ rescue I18n::InvalidLocale
+ Boty.locale = :en
+ end
+ Boty::Locale.reload
+end
+set_locale ARGV.pop
+
session = Boty::Session.new
session.start do |bot|
- Boty.locale = ARGV.pop || :en
-
- bot.desc I18n.t "template.presence", bot_name: bot.name
- bot.message(/#{bot.name}/i) do |message|
- next if message.from? self
+ bot.desc bot.name, I18n.t("template.presence", bot_name: bot.name)
+ bot.hear(/#{bot.name}/i) do
+ next if message_from_me?
say I18n.t "template.hello", user_name: message.user.name
end
end