-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.rb
48 lines (33 loc) · 1.24 KB
/
main.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
require_relative 'xshellz'
require_relative 'user'
require 'ruby-progressbar'
# Let's instantiate from the class User an object user that gets by default when the shell expires
user = User.new("https://www.xshellz.com/api/json/", "crawler", "shellexpires")
hours_to_expire = user.message
# Reading settings from YML
settings = YAML.load_file('account.yml')
server = settings['xshellz']['server']
port = settings['xshellz']['port']
username = settings['xshellz']['username']
renew = settings['xshellz']['renew']
puts "-----------------------------------"
puts " Running xshellz bot | Hours #{hours_to_expire}"
puts "-----------------------------------"
#puts "Account: #{username}"
#puts "Hours: #{hours_to_expire}"
# The shell expires in 2 weeks which is 336 hours, so let's renew the shell every 84 hours
if hours_to_expire <= renew
# Running BotXshellZ
client = XshellZ.new(server, port, username)
trap("INT"){ client.disconnect }
# Setting the channel writter attribute
client.channel = "#tjt"
# Joinning the channel
client.join_channel
# Setting the message writter attribute
client.message = "!keep #{username}"
# Sending the message to the channel
client.send_msg
# Closing the socket nicely
client.disconnect
end