kag-gather 1.4.8 → 1.4.9

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2E4YWM4ODA4OGM2NGZjZGU3ZjAwNWY1ZGNhOWJiNWFlYjI3OWZlNw==
4
+ ODk3YzJkM2M2ODRhMzQzM2FhMjQzZmI0NGYxZjZlY2Y5OTg3MzY2OQ==
5
5
  data.tar.gz: !binary |-
6
- ZjA5M2QzZmY0OWNjZjA0N2YzYTUyNDNiODg5MGZlMzdjOTJhYTRhYw==
6
+ OWNlNDk0MDFhY2QwMTkzMTM4YWRlNjM5NTUzZmY5MTNjM2UwNzQ2ZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NjExZGRjMzY2ZTFjN2M2YjUxMjdiMTg2Y2JlODg5ZGMxY2M2OWZiMjQwZmIy
10
- NjEyMTgwYWViNmU3NWExNzFlYTMxZjdhOWYzNWVhMjBmNTAxNGUxNGIzYTEz
11
- ODM0Yzk3N2IzYzc0MjUzNDg3MWFjMDA2OTIxYTdmZDdkNTZmZGQ=
9
+ ZGQ4NGY5ZWFiMjQ1NWE5MmVjOGM4ZGRiNzU1N2M1YzMwOTk5YTU1NTA2NWNh
10
+ NzI2ZDNkYjRmYjZjNzY4MjUxNTAwYzc5MzExYmNlN2U3YWJjMmZmNWU2YjJm
11
+ N2VmNTk0ZmNkMTFhZGFmZTQ4OGViOWQwZDIwYzg1MzVlYzNiZmI=
12
12
  data.tar.gz: !binary |-
13
- YWNmMDk1ZDMxN2M0MWU5MjNlYjllN2ViOGZhY2I2MDJhNGU2OTg1ZmY5MDVl
14
- ZjA5YmNhYjE0NGNlNzQ5MmI0MWQ3NjJjMzE3NTIzODlkNjVmOWZhZDEzYzM1
15
- NzdiN2E4MDZkOWYxZDEyZDVmN2M4ZTk3OGVhNTQ0ZDUwNWYwMzY=
13
+ YWQyMzEwNjg0NTc5Mjk0MzRhNjk2ZjM0Nzc3ZDVhYmNlZTdlNWJkMGIwMjk5
14
+ MWQ0NzdiMDRjNDRmYTI2NGIwMGM1YzczZWQ4OTdhZmI4ZGY5MzdiZGEzOTFm
15
+ ZTc3MjQ3MDE4ZjdiYmYyM2RjMTIzZDk2ZmFmMDlhMTEyY2FhOWU=
data/lib/commands/help.rb CHANGED
@@ -12,12 +12,14 @@ module Cinch
12
12
  include Cinch::Commands
13
13
  include KAG::Common
14
14
 
15
- command :help, {command: :string},
15
+ command :h, {command: :string},
16
16
  summary: %{Displays help information for the COMMAND},
17
+ method: :help,
17
18
  description: %{Finds the COMMAND and prints the usage and description for the COMMAND.}
18
19
 
19
- command :help, {},
20
+ command :h, {},
20
21
  summary: "Lists available commands",
22
+ method: :help,
21
23
  description: %{If no COMMAND argument is given, then all commands will be listed.}
22
24
 
23
25
  #
@@ -47,7 +49,7 @@ module Cinch
47
49
  # print the description of the first command
48
50
  desc = found.first.description.to_s
49
51
  msg = "\x0302#{msg.join(", ")}\x0314"+(desc != "" ? " - #{desc}" : " - #{found.first.summary.to_s}")
50
- User(m.user.nick).send(msg)
52
+ m.user.send(msg)
51
53
  end
52
54
  else
53
55
  msg = []
@@ -55,7 +57,7 @@ module Cinch
55
57
  #msg << "\x0302#{cmd.usage}\x0314: #{cmd.summary}" unless (cmd.admin and !is_admin(m.user))
56
58
  msg << "!"+cmd.usage
57
59
  end
58
- User(m.user.nick).send(msg.join ", ")
60
+ m.user.send(msg.join ", ")
59
61
  end
60
62
  end
61
63
 
@@ -157,7 +157,7 @@ module KAG
157
157
  puts e.backtrace
158
158
  end
159
159
  else
160
- user.send "You must first AUTH on the IRC server via Q before you can use this bot."
160
+ user.send _h("command_not_authed")
161
161
  KAG::Config.data.add_action(user)
162
162
  end
163
163
  end
data/lib/kag/bot/bot.rb CHANGED
@@ -7,6 +7,7 @@ require 'kag/bans/plugin'
7
7
  require 'kag/irc/plugin'
8
8
  require 'kag/bot/plugin'
9
9
  require 'kag/user/plugin'
10
+ require 'kag/help/plugin'
10
11
  require 'commands/help'
11
12
 
12
13
  module KAG
@@ -30,7 +31,8 @@ module KAG
30
31
  KAG::Gather::Plugin,
31
32
  KAG::Bans::Plugin,
32
33
  KAG::IRC::Plugin,
33
- KAG::User::Plugin
34
+ KAG::User::Plugin,
35
+ KAG::Help::Plugin
34
36
  ]
35
37
  if config[:sasl]
36
38
  c.sasl.username = config[:sasl][:username]
data/lib/kag/common.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'kag/help/book'
1
2
 
2
3
  module KAG
3
4
  module Common
@@ -30,5 +31,17 @@ module KAG
30
31
  o = (KAG::Config.instance[:owners] or [])
31
32
  o.include?(user.authname)
32
33
  end
34
+
35
+ def _h(key,params = {})
36
+ if KAG::Help::Book.instance.key?(key.to_sym)
37
+ text = KAG::Help::Book.instance[key.to_sym].to_s
38
+ params.each do |k,v|
39
+ text.gsub!("[[+"+k.to_s+"]]",v)
40
+ end
41
+ text
42
+ else
43
+ ""
44
+ end
45
+ end
33
46
  end
34
47
  end
@@ -68,6 +68,7 @@ module KAG
68
68
  if match.needs_sub?
69
69
  placement = match.sub_in(m.user)
70
70
  if placement
71
+ placement[:channel_msg] = placement[:channel_msg].gsub("[[+user]]",m.user.authname)
71
72
  reply m,placement[:channel_msg]
72
73
  m.user.send placement[:private_msg]
73
74
  end
@@ -54,7 +54,7 @@ module KAG
54
54
  sub[:cls] = self.teammates[user.authname.to_sym]
55
55
  sub[:team] = self.clone
56
56
  sub[:msg] = "Sub needed at #{self.match.server[:ip]} for #{sub[:team][:name]}, #{sub[:cls]} Class! Type !sub to claim it!"
57
- sub[:channel_msg] = "#{user.authname} is now subbing in for #{self[:name]} at #{self.match.server[:key]}. Subs still needed: #{self.match[:subs_needed].length}"
57
+ sub[:channel_msg] = "[[+user]] is now subbing in for #{self[:name]} at #{self.match.server[:key]}. Subs still needed: #{self.match[:subs_needed].length}"
58
58
  sub[:private_msg] = "Please #{self.match.server.text_join} | #{sub[:cls]} on the #{self[:name]} Team"
59
59
  self.players.delete(user.authname.to_sym)
60
60
  self.teammates.delete(user.authname.to_sym)
@@ -0,0 +1,41 @@
1
+ module KAG
2
+ module Help
3
+ class Book < Hash
4
+ include Singleton
5
+
6
+ def initialize(hash=nil)
7
+ super
8
+ self.merge!(self._load)
9
+ end
10
+
11
+ def _load
12
+ unless File.exists?("config/help.json")
13
+ File.open("config/help.json","w") {|f| f.write("{}") }
14
+ end
15
+ f = ::IO.read("config/help.json")
16
+ if f and !f.empty?
17
+ SymbolTable.new(JSON.parse(f))
18
+ else
19
+ SymbolTable.new
20
+ end
21
+ end
22
+
23
+ def reload
24
+ puts "Reloading help file..."
25
+ self.merge!(self._load)
26
+ end
27
+
28
+ # Sets the value of the given +key+ to +val+.
29
+ def store(key, val)
30
+ super(key,val)
31
+ self.save
32
+ end
33
+
34
+ def save
35
+ File.open("config/help.json","w") do |f|
36
+ f.write(self.to_json)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,28 @@
1
+ require 'cinch'
2
+ require 'kag/common'
3
+ require 'commands/help'
4
+
5
+ module KAG
6
+ module Help
7
+ class Plugin
8
+ include Cinch::Plugin
9
+ include Cinch::Commands
10
+ include KAG::Common
11
+
12
+ command :help,{},
13
+ summary: "Get general help on KAG Gather",
14
+ admin: true
15
+ def help(m)
16
+ if m.user.authed?
17
+ m.user.send(_h("general_help",{
18
+ :nick => m.user.nick
19
+ }))
20
+ else
21
+ m.user.send(_h("general_not_authed",{
22
+ :nick => m.user.nick
23
+ }))
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -23,6 +23,16 @@ module KAG
23
23
  end
24
24
  end
25
25
 
26
+ command :authed,{},
27
+ summary: "Tell if you are authed"
28
+ def authed(m)
29
+ if m.user.authed?
30
+ reply m,"#{m.user.nick} is authed."
31
+ else
32
+ reply m,"#{m.user.nick} is not yet authed. Please type !help to get help with authenticating."
33
+ end
34
+ end
35
+
26
36
  command :authname,{nick: :string},
27
37
  summary: "Get the AUTH name of a user",
28
38
  admin: true
data/lib/kag/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module KAG
2
- VERSION = '1.4.8'
2
+ VERSION = '1.4.9'
3
3
  def self.version
4
4
  VERSION
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kag-gather
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.8
4
+ version: 1.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun McCormick
@@ -131,6 +131,8 @@ files:
131
131
  - lib/kag/gather/plugin.rb
132
132
  - lib/kag/gather/queue.rb
133
133
  - lib/kag/gather/team.rb
134
+ - lib/kag/help/book.rb
135
+ - lib/kag/help/plugin.rb
134
136
  - lib/kag/irc/plugin.rb
135
137
  - lib/kag/server.rb
136
138
  - lib/kag/user/plugin.rb