Skip to content

Commit 7263e6e

Browse files
committed
Added trial link to help.
1 parent 04eae19 commit 7263e6e

File tree

20 files changed

+126
-28
lines changed

20 files changed

+126
-28
lines changed

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source 'https://rubygems.org'
24

35
ruby '2.6.6'

Rakefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'rubygems'
24

35
require 'rspec/core'

app.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# frozen_string_literal: true
2+
3+
Dir[File.expand_path('config/initializers', __dir__) + '/**/*.rb'].sort.each do |file|
4+
require file
5+
end
6+
7+
require_relative 'lib/models'
8+
require_relative 'lib/commands'

commands.rb

Lines changed: 0 additions & 2 deletions
This file was deleted.

commands/help.rb

Lines changed: 0 additions & 18 deletions
This file was deleted.

config.ru

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
# frozen_string_literal: true
2+
13
ENV['RACK_ENV'] ||= 'development'
24

35
Bundler.require :default
46

5-
require_relative 'commands'
7+
require_relative 'app'
68

79
Mongoid.load!(File.expand_path('config/mongoid.yml', __dir__), ENV['RACK_ENV'])
810

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
SlackRubyBotServer::Stripe.configure do |config|
4+
config.stripe_api_key = ENV['STRIPE_API_KEY']
5+
config.stripe_api_publishable_key = ENV['STRIPE_API_PUBLISHABLE_KEY']
6+
config.subscription_plan_id = ENV['STRIPE_SUBSCRIPTION_PLAN_ID']
7+
config.trial_duration = 2.weeks
8+
config.root_url = ENV['URL'] || 'http://localhost:5000'
9+
end

lib/commands.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# frozen_string_literal: true
2+
3+
require_relative 'commands/help'

lib/commands/help.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# frozen_string_literal: true
2+
3+
class Help < SlackRubyBot::Commands::Base
4+
HELP = <<~EOS
5+
```
6+
Sample bot that uses slack-ruby-bot-server-stripe.
7+
8+
General
9+
-------
10+
11+
help - get this helpful message
12+
13+
```
14+
EOS
15+
def self.call(client, data, _match)
16+
client.say(channel: data.channel, text: [
17+
HELP,
18+
client.owner.reload.subscribed? ? nil : client.owner.trial_text
19+
].compact.join("\n"))
20+
client.say(channel: data.channel, gif: 'help')
21+
logger.info "HELP: #{client.owner}, user=#{data.user}"
22+
end
23+
end

lib/models.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# frozen_string_literal: true
2+
3+
require_relative 'models/team'

0 commit comments

Comments
 (0)