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