Skip to content

Commit a268475

Browse files
committed
Merge pull request #78 from Namasteh/v7.0alpha2.1.0
v7.0alpha2.1.0
2 parents 2c1beea + 5a0d0a3 commit a268475

File tree

7 files changed

+59
-19
lines changed

7 files changed

+59
-19
lines changed

Eve.rb

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,42 @@
44
require_relative 'lib/utils/config_checks'
55
require_relative 'lib/helpers/file_handler'
66

7-
$eve_version = "7.0"
7+
$eve_version = "7.0alpha2.1.0"
8+
9+
# Find out of there is a config file, if
10+
# there is a config file then it pulls
11+
# the IRC server from the settings file.
12+
# Otherwise, the bot will default to it's
13+
# home server of Sinsira.
814

915
if $settings_file.nil?
10-
botnick = "Eve"
16+
irc_server = "irc.sinsira.net"
17+
server_port = "6667"
18+
server_ssl = "false"
19+
ssl_verify = "false"
20+
botnick = "Eve"
1121
else
12-
botnick = $settings_file['nick'].to_s
22+
irc_server = $settings_file['irc_server'].to_s
23+
server_port = $settings_file['server_port'].to_s
24+
server_ssl = $settings_file['server_ssl'].to_s
25+
ssl_verify = $settings_file['ssl_verify'].to_s
26+
botnick = $settings_file['nick']
1327
end
1428

1529
bot = Cinch::Bot.new do
1630
configure do |c|
17-
c.server = "irc.catiechat.net"
18-
c.channels = [
19-
"#Eve"
20-
]
21-
c.nick = "#{botnick}"
22-
c.user = "Eve"
23-
c.realname = "Eve 7"
24-
c.password = "foo"
25-
c.encoding = "UTF-8"
26-
f = open("config/settings/constants.rb")
31+
c.server = "#{irc_server}"
32+
c.port = "#{server_port}"
33+
c.ssl.use = server_ssl
34+
c.ssl.verify = false
35+
c.channels = [
36+
"#Eve"
37+
]
38+
c.nick = "#{botnick}"
39+
c.user = "Eve"
40+
c.realname = "Eve #{$eve_version}"
41+
c.encoding = "UTF-8"
42+
f = open("config/settings/constants.rb")
2743
c.plugins.plugins = []
2844
f.each_line {|line|
2945
line = Object.const_get(line.chomp)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.0.0.1
1+
7.0.0.2

lib/utils/config_checks.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Cinch
66
module Plugins
77
class ConfigChecks
88
include Cinch::Plugin
9-
9+
1010
# This block checks for several files, and
1111
# if they are not there it will run the first-
1212
# run wizard for the associated core plugin.
@@ -35,6 +35,8 @@ def initialize(*args)
3535
else
3636
load 'lib/utils/plugins_first_run.rb'
3737
PluginsFirstRun.new(*args)
38+
puts "Restarting bot to apply first run changes..."
39+
system("kill #{Process.pid}&& ruby Eve.rb")
3840
end
3941
end
4042
end

lib/utils/first_run.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,29 @@ def initialize(*args)
4646
pf = "~"
4747
end
4848

49+
irc_server = ask("Please enter the server address you would like the bot to connect to: ") {|server|
50+
server.responses[:ask_on_error] = "Please specify the IRC server address you'd like the bot to connect to: "
51+
server.confirm = "Are you sure that you'd like to set <%= @answer %> as the IRC server the bot will connect to? [yes/no]: "
52+
}
53+
@settings['irc_server'] = irc_server.to_s
54+
55+
server_port = ask("What port would you like the bot to connect through? [6667]") {|port|
56+
port.default = "6667"
57+
port.responses[:ask_on_error] = "Please specify a port that you'd like the bot to connect through: "
58+
port.confirm = "Are you sure you want to set connect to #{irc_server} through port <%= @answer %>?"
59+
}
60+
@settings['server_port'] = server_port.to_s
61+
62+
if agree("Does #{irc_server}'s port #{server_port} use SSL? [yes/no]: ")
63+
@settings['server_ssl'] = true
64+
if agree("Does #{irc_server} use a self-signed SSL certificate? [yes/no]: ")
65+
@settings['ssl_verify'] = false
66+
else
67+
@settings['ssl_verify'] = true
68+
end
69+
else
70+
@settings['server_ssl'] = false
71+
end
4972

5073
# Attempt to get e-mail from user for NickServ registration
5174
say("#{botnick} will need an e-mail for certain things, like registering for NickServ. Please take note that the e-mail won't necessarily be publicly available, but that option is available for support!")

plugins/core/admin_handler.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def status(m)
2525
match /login$/i, method: :login
2626

2727
def login(m)
28-
if authentication
28+
if authentication(m)
2929
m.reply "You are currently logged into the bot."
3030
timeout_handler(m)
3131
else

plugins/core/bot_control.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ class BotControl
1212

1313
def off(m)
1414
return unless authentication(m)
15-
quit_safely
1615
plugin_name = "BotControl"
1716
log_message("message", "Received 'off' command from #{m.user.nick}...", plugin_name)
18-
exit_normally
17+
quit_safely
1918
bot.quit("on command of #{m.user.nick}. Exiting normally...")
2019
end
2120

setup.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ def install_check(gem)
2525
puts "Checking if 'activesupport' is installed..."
2626
install_check("activesupport")
2727
puts "Required dependencies for eve7 now installed."
28-
puts "Opening install script..."
28+
puts "You can now run the Install Wizard by typing: ruby install.rb"
2929
system("kill #{Process.pid}")
3030

0 commit comments

Comments
 (0)