-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmumblebot.rb
94 lines (86 loc) · 2.48 KB
/
mumblebot.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
require 'mumble-ruby'
require 'nokogiri'
require 'net/http'
$cli = Mumble::Client.new('brianherman.dyndns.tv', 64738, 'MumbleBot')
#$cli = Mumble::Client.new('mumble.nerd.nu',6162 , 'MumbleBot')
$cli.on_text_message do |msg|
case msg.message.chomp
when /lookup/
Net::HTTP.start( 'www.mcbouncer.com', 80 ) do |http|
lookup = msg.message.slice(7,msg.message.length)
puts lookup
body = http.get( '/user/'+lookup+'/bansFor' ).body
doc = Nokogiri::HTML(body)
doc.css('#json-table td').each do |link|
puts link
$cli.text_user($cli.users[msg.actor].name,link.content);
puts link.content.length
end
#puts body
puts $cli.users[msg.actor]
end
when /notes/
Net::HTTP.start( 'www.mcbouncer.com', 80 ) do |http|
lookup = msg.message.slice(6,msg.message.length)
puts lookup
body = http.get( '/user/'+lookup+'/notesFor' ).body
doc = Nokogiri::HTML(body)
doc.css('#json-table td').each do |link|
puts link
$cli.text_user($cli.users[msg.actor].name,link.content);
puts link.content.length
end
#puts body
puts $cli.users[msg.actor]
end
when /notesmade/
Net::HTTP.start( 'www.mcbouncer.com', 80 ) do |http|
lookup = msg.message.slice(10,msg.message.length)
puts lookup
body = http.get( '/user/'+lookup+'/notesBy' ).body
doc = Nokogiri::HTML(body)
doc.css('#json-table td').each do |link|
puts link
$cli.text_user($cli.users[msg.actor].name,link.content);
puts link.content.length
end
#puts body
puts $cli.users[msg.actor]
end
when /ipbans/
Net::HTTP.start( 'www.mcbouncer.com', 80 ) do |http|
lookup = msg.message.slice(7,msg.message.length)
puts lookup
body = http.get( '/user/'+lookup+'/ipBansBy' ).body
doc = Nokogiri::HTML(body)
doc.css('#json-table td').each do |link|
puts link
$cli.text_user($cli.users[msg.actor].name,link.content);
puts link.content.length
end
#puts body
puts $cli.users[msg.actor]
end
when /bansBy/
Net::HTTP.start( 'www.mcbouncer.com', 80 ) do |http|
lookup = msg.message.slice(7,msg.message.length)
puts lookup
body = http.get( '/user/'+lookup+'/notesbansBy' ).body
doc = Nokogiri::HTML(body)
doc.css('#json-table td').each do |link|
puts link
$cli.text_user($cli.users[msg.actor].name,link.content);
puts link.content.length
end
#puts body
puts $cli.users[msg.actor]
end
when "disconnect"
$cli.disconnect
else
puts msg.message
end
end
$cli.connect
while true
end