cinch-isitup 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/cinch/plugins/isitup.rb +54 -0
- metadata +59 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: 5579c9d2c79e9ec07151251a602e004153a9911c
|
4
|
+
data.tar.gz: 75243fe8f7f474e5266151859cb02d65768e717b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f3a10da0cf5bd4635af7049560c4c178dabc417a49a3dd925dcd8ff1b577ddb884d4c9c96fe9873226be9ee115eac5bb2d698ec17b35f8618ea0fe4f8d1081a6
|
7
|
+
data.tar.gz: 61fcf2abbb2eb6e70f526e59f824137878973cbd175388507e09e2071e413eb83a2ae759871ba46b3992a237238ac643e978b93b453eb356e2324f41e9712bee
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'cinch'
|
2
|
+
require 'ostruct'
|
3
|
+
require 'open-uri'
|
4
|
+
require 'json'
|
5
|
+
require 'cgi'
|
6
|
+
|
7
|
+
module Cinch
|
8
|
+
module Plugins
|
9
|
+
class Isitup
|
10
|
+
include Cinch::Plugin
|
11
|
+
|
12
|
+
set :plugin_name, 'isitup'
|
13
|
+
set :help, <<-USAGE.gsub(/^ {6}/, '')
|
14
|
+
Is it just you, or is your favorite website down? Find out!
|
15
|
+
Usage:
|
16
|
+
* ~isitup <url>: Checks to see if the given website is up or not.
|
17
|
+
USAGE
|
18
|
+
|
19
|
+
match /isitup (.+)/
|
20
|
+
|
21
|
+
def execute(m, query)
|
22
|
+
data = check(query)
|
23
|
+
return m.reply "There seems to be an issue, please contact my Master." if data.nil?
|
24
|
+
isitup_result(m, data)
|
25
|
+
end
|
26
|
+
|
27
|
+
def check(terms)
|
28
|
+
data = JSON.parse(open("http://isitup.org/#{terms}.json").read)
|
29
|
+
OpenStruct.new(
|
30
|
+
domain: data['domain'],
|
31
|
+
status: data['status_code'],
|
32
|
+
time: data['response_time']
|
33
|
+
)
|
34
|
+
rescue
|
35
|
+
nil
|
36
|
+
end
|
37
|
+
|
38
|
+
def isitup_result(m, data)
|
39
|
+
if data.status == 3
|
40
|
+
m.reply Format(:red, "That is not a valid domain!")
|
41
|
+
return;
|
42
|
+
end
|
43
|
+
if data.status == 2
|
44
|
+
m.reply "4The domain:13 #{data.domain}4 is down!"
|
45
|
+
return;
|
46
|
+
end
|
47
|
+
if data.status == 1
|
48
|
+
m.reply "3The domain: 13#{data.domain}3 is up! Response time: 13#{data.time}."
|
49
|
+
return;
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cinch-isitup
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Richard Banks
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: cinch
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.1.0
|
27
|
+
description: A simple plugin to check if a website is up or down
|
28
|
+
email:
|
29
|
+
- namaste@rawrnet.net
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- lib/cinch/plugins/isitup.rb
|
35
|
+
homepage: https://github.com/RawrNet/cinch-isitup
|
36
|
+
licenses:
|
37
|
+
- MIT
|
38
|
+
metadata: {}
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
requirements: []
|
54
|
+
rubyforge_project: ! '[none]'
|
55
|
+
rubygems_version: 2.1.11
|
56
|
+
signing_key:
|
57
|
+
specification_version: 4
|
58
|
+
summary: A simple plugin to check if a website is up or down.
|
59
|
+
test_files: []
|