This repository has been archived by the owner on Aug 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.rb
69 lines (57 loc) · 1.71 KB
/
bot.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
# Require Gems needed to run programs and plugins
require './requiregems.rb'
# Load config from file
begin
CONFIG = YAML.load_file('config.yaml')
rescue StandardError
puts 'Config file not found, this is fatal.'
exit
end
# Require each plugin
Dir["#{File.dirname(__FILE__)}/plugins/*.rb"].each { |file| require file }
# Pre-Config
botnick = "HowMuchLitecoinHas#{CONFIG['miner']}Mined"
botserver = if CONFIG['server'] == '' || CONFIG['server'].nil?
puts 'You did not configure a server for the bot to connect to. Please set one!'
exit
else
CONFIG['server'].to_s
end
botport = if CONFIG['port'].nil?
'6667'
else
CONFIG['port']
end
commits = `git rev-list master | wc -l`.to_i
commit = if commits.zero?
''
else
" | Version: #{commits}"
end
botrealname = "HowMuchLitecoinHasChewMined Bot - https://github.com/Chewbotcca/HowMuchLitecoinHasChewMined#{commit}"
botssl = if CONFIG['ssl'].nil? || CONFIG['ssl'] == '' || CONFIG['ssl'] == 'false' || CONFIG['ssl'] == false
nil
else
'true'
end
botserverpass = if CONFIG['serverpass'].nil? || CONFIG['serverpass'] == ''
nil
else
CONFIG['serverpass']
end
# Configure the Bot
bot = Cinch::Bot.new do
configure do |c|
# Bot Settings, Taken from pre-config
c.nick = botnick
c.server = botserver
c.channels = [CONFIG['channels']]
c.port = botport
c.realname = botrealname
c.ssl.use = botssl
c.password = botserverpass
c.plugins.prefix = //
c.plugins.plugins = [Main, NickServ]
end
end
bot.start