tipjar 0.1.16 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
- # Bitbot v0.0.5
1
+ # Bitbot v0.1.16
2
2
 
3
3
  An IRC bit-tip style bot using blockchain.info as a payment route.
4
- * 0.0.5 Update schema to reflect different bot name etc
5
4
 
6
5
  ## Security
7
6
 
data/bitbot.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.email = ["weirdthall@gmail.com", "zach@zwily.com"]
9
9
  s.homepage = %q{http://github.com/zwily/bitbot}
10
10
  s.summary = %q{Bitcoin IRC Tip Bot}
11
- s.description = ["A Bitcoin IRC Tip Bot on freenode"]
11
+ s.decription = ["A Bitcoin IRC Tip Bot on freenode"]
12
12
 
13
13
  s.files = `git ls-files`.split("\n")
14
14
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -1,29 +1,40 @@
1
- module Bitbot::Prize
2
- # create and initialise the random number generator
3
- prng = Random.new
4
- # create the rules for winning
1
+ # coding: utf-8
5
2
 
6
- # No win
7
- # [1-865] 86.5% chance
3
+ module Bitbot::Prize
4
+ def on_prize(m, recipient, amount, message)
5
+ # Look up sender
6
+ user_id = db.get_or_create_user_id_for_username(m.user.user)
8
7
 
8
+ # Look up recipient
9
+ recipient_ircuser = m.channel.users.keys.find {|u| u.name == recipient }
10
+ unless recipient_ircuser
11
+ m.user.msg("Could not find #{recipient} in the channel list.")
12
+ return
13
+ end
14
+ recipient_user_id = db.get_or_create_user_id_for_username(recipient_ircuser.user)
9
15
 
10
- # Standard chat win of 10 + 1 - 500 satoshi max of 501 satoshi (0.00501mBTC)
11
- # [866 - 940] 7.5% chance
12
- def prize_win_std
13
- end
16
+ # Convert amount to satoshi
17
+ satoshi = str_to_satoshi(amount)
18
+ if satoshi <= 0
19
+ m.user.msg("Cannot send a negative amount.")
20
+ return
21
+ end
14
22
 
15
- # Minor prize win of 1000 satoshi max 1000 satoshi (0.01mBTC)
16
- # [941-990] 5% chance
17
- def prize_win_minor
18
- end
23
+ # Attempt the transaction (will raise on InsufficientFunds)
24
+ begin
25
+ db.create_transaction_from_tip(user_id, recipient_user_id, satoshi, message)
26
+ rescue Bitbot::InsufficientFundsError
27
+ m.reply "Insufficient funds! It's the thought that counts though :).", true
28
+ return
29
+ end
19
30
 
20
- # Major prize win of 10000 satoshi max of 10000 satoshi (0.1mBTC)
21
- # [991-1000] 1% chance
22
- def prize_win_major
23
- end
31
+ # Success! Let the room know...
32
+ m.reply "[] Verified: ".irc(:grey).irc(:bold) +
33
+ m.user.user.irc(:bold) +
34
+ " ➜ ".irc(:grey) +
35
+ satoshi_with_usd(satoshi) +
36
+ " ➜ ".irc(:grey) +
37
+ recipient_ircuser.user.irc(:bold)
24
38
 
25
- # Check every 10 mins for bot balance, if less than 0.1mBTC then pause all payouts and print out message
26
- # this can also be run from plugin.rb on a set timer rather than duplicating here
27
- def prize_win_balance_check
28
- end
39
+ end
29
40
  end
@@ -1,5 +1,5 @@
1
1
  module Bitbot::Version
2
2
  def on_version
3
- m.user.msg "I am version 0.0.5 BETA. I am owned and operated by WeirdThall."
3
+ m.user.msg "I am version 0.1.18 BETA. I am owned and operated by WeirdThall."
4
4
  end
5
5
  end
data/lib/bitbot/plugin.rb CHANGED
@@ -15,7 +15,7 @@ require 'bitbot/plugin/update_exchange_rates'
15
15
  require 'bitbot/plugin/txfee'
16
16
  require 'bitbot/plugin/doc'
17
17
  require 'bitbot/plugin/online'
18
- require 'bitbot/plugin/prize'
18
+ # require 'bitbot/plugin/prize'
19
19
 
20
20
  class Bitbot::Plugin
21
21
  include Cinch::Plugin
@@ -33,7 +33,7 @@ class Bitbot::Plugin
33
33
  include Bitbot::Txfee
34
34
  include Bitbot::Doc
35
35
  include Bitbot::Online
36
- include Bitbot::Prize
36
+ # include Bitbot::Prize
37
37
 
38
38
  def initialize(bot)
39
39
  super
@@ -43,41 +43,52 @@ class Bitbot::Plugin
43
43
  set :prefix, ""
44
44
 
45
45
  #
46
- # Private messages
46
+ # Private messages ~ replies sent via PRIVMSG
47
47
  #
48
48
  match /^help(.*)$/, :method => :on_help, :react_on => :private
49
49
  match /^balance$/, :method => :on_balance, :react_on => :private
50
50
  match /^history$/, :method => :on_history, :react_on => :private
51
51
  match /^withdraw(.*)$/, :method => :on_withdraw, :react_on => :private
52
52
  match /^deposit$/, :method => :on_deposit, :react_on => :private
53
- match /^\+tip\s+(\w+)\s+([\d.]+)\s+?(.*)/, :method => :on_tip, :react_on => :private
53
+ match /^ping$/, :method => :on_ping, :react_on => :private
54
+ # match /^\+prize\s+(\w+)\s+([\d.]+)\s+?(.*)/, :method => :on_prize, :react_on => :private
54
55
 
55
56
  #
56
- # Channel messages
57
+ # Private messages ~ replies sent via channel
58
+ #
59
+ match /^\+tip\s+(\w+)\s+([\d.]+)\s+?(.*)/, :method => :on_tip, :react_on => :channel
60
+
61
+ #
62
+ # Channel messages ~ replies sent via channel
57
63
  #
58
64
  match /^\+help(.*)$/, :method => :on_help, :react_on => :channel
59
65
  match /^\+tipstats$/, :method => :on_tipstats, :react_on => :channel
60
66
  match /^\+tip\s+(\w+)\s+([\d.]+)\s+?(.*)/, :method => :on_tip, :react_on => :channel
61
- match /^\+doc$/, :method => :on_tipstats, :react_on => :channel
62
- match /^\+ticker$/, :method => :on_tipstats, :react_on => :channel
67
+ match /^\+doc$/, :method => :on_doc, :react_on => :channel
68
+ match /^\+ticker$/, :method => :on_ticker, :react_on => :channel
69
+ match /^\+txfee$/, :method => :on_txfee, :react_on => :channel
70
+ match /^\+version$/, :method => :on_version, :react_on => :channel
71
+
72
+ #
73
+ # Channel messages ~ replies sent via PRIVMSG
74
+ #
75
+ match /^\+balance$/, :method => :on_balance, :react_on => :private
76
+ match /^\+help$/, :method => :on_help, :react_on => :private
77
+ match /^\+history$/, :method => :on_history, :react_on => :private
63
78
 
64
79
  #
65
80
  # Timer jobs
66
81
  #
67
82
  timer 60, :method => :on_update_exchange_rates
68
83
  timer 60, :method => :on_update_addresses
69
- timer 10, :method => :on_prize_win_check_balance
84
+ # timer 10, :method => :on_prize_win_check_balance
70
85
 
71
86
  #
72
87
  # Also run the timer jobs on connect
73
88
  #
74
89
  listen_to :connect, :method => :on_update_exchange_rates
75
90
  listen_to :connect, :method => :on_update_addresses
76
- listen_to :connect, :method => :on_online
77
- listen_to :connect, :method => :on_doc
91
+ # listen_to :connect, :method => :on_online
92
+ # listen_to :connect, :method => :on_doc
78
93
 
79
- #
80
- # Run these jobs on every channel message
81
- #
82
- listen_to :channel, :method => :on_prize
83
94
  end
data/tipjar.gemspec CHANGED
@@ -1,18 +1,18 @@
1
1
  $:.push File.expand_path("../lib", __FILE__)
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = %q{tipjar}
5
- s.version = "0.1.16"
6
- s.platform = Gem::Platform::RUBY
7
- s.authors = ["WeirdThall", "Zach Wily"]
8
- s.email = ["weirdthall@gmail.com", "zach@zwily.com"]
9
- s.homepage = %q{http://github.com/zwily/bitbot}
10
- s.summary = %q{Bitcoin IRC Tip Bot}
11
- s.description = ["A Bitcoin IRC Tip Bot on freenode"]
4
+ s.name = %q{tipjar}
5
+ s.version = "0.1.18"
6
+ s.platform = Gem::Platform::RUBY
7
+ s.authors = ["WeirdThall", "Zach Wily"]
8
+ s.email = ["weirdthall@gmail.com", "zach@zwily.com"]
9
+ s.homepage = %q{http://github.com/weirdthall/TipJar}
10
+ s.summary = %q{Bitcoin IRC Tip Bot}
11
+ s.description = ["A Bitcoin IRC Tip Bot on freenode"]
12
12
 
13
- s.files = `git ls-files`.split("\n")
14
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
16
  s.default_executable = %q{bitbot}
17
17
  s.require_paths = ["lib"]
18
18
 
@@ -25,4 +25,3 @@ Gem::Specification.new do |s|
25
25
  s.add_development_dependency "rspec", "~> 2.5"
26
26
  s.add_development_dependency "yard"
27
27
  end
28
-
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tipjar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.18
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - WeirdThall
@@ -9,67 +10,76 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-11-04 00:00:00.000000000 Z
13
+ date: 2013-11-09 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: cinch
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
- - - '>='
20
+ - - ! '>='
19
21
  - !ruby/object:Gem::Version
20
22
  version: '0'
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
- - - '>='
28
+ - - ! '>='
26
29
  - !ruby/object:Gem::Version
27
30
  version: '0'
28
31
  - !ruby/object:Gem::Dependency
29
32
  name: daemons
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
- - - '>='
36
+ - - ! '>='
33
37
  - !ruby/object:Gem::Version
34
38
  version: '0'
35
39
  type: :runtime
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
- - - '>='
44
+ - - ! '>='
40
45
  - !ruby/object:Gem::Version
41
46
  version: '0'
42
47
  - !ruby/object:Gem::Dependency
43
48
  name: sqlite3
44
49
  requirement: !ruby/object:Gem::Requirement
50
+ none: false
45
51
  requirements:
46
- - - '>='
52
+ - - ! '>='
47
53
  - !ruby/object:Gem::Version
48
54
  version: '0'
49
55
  type: :runtime
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
52
59
  requirements:
53
- - - '>='
60
+ - - ! '>='
54
61
  - !ruby/object:Gem::Version
55
62
  version: '0'
56
63
  - !ruby/object:Gem::Dependency
57
64
  name: httparty
58
65
  requirement: !ruby/object:Gem::Requirement
66
+ none: false
59
67
  requirements:
60
- - - '>='
68
+ - - ! '>='
61
69
  - !ruby/object:Gem::Version
62
70
  version: '0'
63
71
  type: :runtime
64
72
  prerelease: false
65
73
  version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
66
75
  requirements:
67
- - - '>='
76
+ - - ! '>='
68
77
  - !ruby/object:Gem::Version
69
78
  version: '0'
70
79
  - !ruby/object:Gem::Dependency
71
80
  name: rspec
72
81
  requirement: !ruby/object:Gem::Requirement
82
+ none: false
73
83
  requirements:
74
84
  - - ~>
75
85
  - !ruby/object:Gem::Version
@@ -77,6 +87,7 @@ dependencies:
77
87
  type: :development
78
88
  prerelease: false
79
89
  version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
80
91
  requirements:
81
92
  - - ~>
82
93
  - !ruby/object:Gem::Version
@@ -84,18 +95,20 @@ dependencies:
84
95
  - !ruby/object:Gem::Dependency
85
96
  name: yard
86
97
  requirement: !ruby/object:Gem::Requirement
98
+ none: false
87
99
  requirements:
88
- - - '>='
100
+ - - ! '>='
89
101
  - !ruby/object:Gem::Version
90
102
  version: '0'
91
103
  type: :development
92
104
  prerelease: false
93
105
  version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
94
107
  requirements:
95
- - - '>='
108
+ - - ! '>='
96
109
  - !ruby/object:Gem::Version
97
110
  version: '0'
98
- description: '["A Bitcoin IRC Tip Bot on freenode"]'
111
+ description: ! '["A Bitcoin IRC Tip Bot on freenode"]'
99
112
  email:
100
113
  - weirdthall@gmail.com
101
114
  - zach@zwily.com
@@ -133,27 +146,29 @@ files:
133
146
  - lib/bitbot/plugin/withdraw.rb
134
147
  - lib/ircstring.rb
135
148
  - tipjar.gemspec
136
- homepage: http://github.com/zwily/bitbot
149
+ homepage: http://github.com/weirdthall/TipJar
137
150
  licenses: []
138
- metadata: {}
139
151
  post_install_message:
140
152
  rdoc_options: []
141
153
  require_paths:
142
154
  - lib
143
155
  required_ruby_version: !ruby/object:Gem::Requirement
156
+ none: false
144
157
  requirements:
145
- - - '>='
158
+ - - ! '>='
146
159
  - !ruby/object:Gem::Version
147
160
  version: '0'
148
161
  required_rubygems_version: !ruby/object:Gem::Requirement
162
+ none: false
149
163
  requirements:
150
- - - '>='
164
+ - - ! '>='
151
165
  - !ruby/object:Gem::Version
152
166
  version: '0'
153
167
  requirements: []
154
168
  rubyforge_project:
155
- rubygems_version: 2.1.10
169
+ rubygems_version: 1.8.23
156
170
  signing_key:
157
- specification_version: 4
171
+ specification_version: 3
158
172
  summary: Bitcoin IRC Tip Bot
159
173
  test_files: []
174
+ has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: edb9688b3b0718910793eb0f8ba0345894ded926
4
- data.tar.gz: 3113b6d46e45d00c61d7ddd3d79ab4af579efe50
5
- SHA512:
6
- metadata.gz: adb39aa9775bb90b9e542fc2f8f7badf672eefd1410b38b7dbccaa13c273e9d8d1c929e2d7e8942c56f924a27aac98d4425b5c31541080d324eec0d7f5dfd629
7
- data.tar.gz: cdfa0c618e46776e828873028c1d5118d52d52b9c87d91d4c58373380a5b483515a475ea68ff868be9bd487133dcd5292e9630424f3e577f399aa74d7b5b3181