Commit 56580044 authored by Cool Fire's avatar Cool Fire

A little cleanup

parent dba5a075
Pipeline #535 passed with stages
in 7 minutes
...@@ -73,4 +73,4 @@ rubocop: ...@@ -73,4 +73,4 @@ rubocop:
- ruby - ruby
script: script:
- gem install rubocop --no-ri --no-rdoc - gem install rubocop --no-ri --no-rdoc
- rubocop -l -f simple --except UnusedMethodArgument,RescueException,Eval,AssignmentInCondition,ScriptPermission - rubocop -l -f simple --except RescueException,Eval,AssignmentInCondition,ScriptPermission
...@@ -123,7 +123,7 @@ class Commands ...@@ -123,7 +123,7 @@ class Commands
end end
# Quit command # Quit command
def quit( nick, user, host, from, msg ) def quit( _nick, _user, host, _from, msg )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( con ) if( con )
@output.cbad( "This will also stop the bot, are you sure? [y/N]: " ) @output.cbad( "This will also stop the bot, are you sure? [y/N]: " )
...@@ -153,7 +153,7 @@ class Commands ...@@ -153,7 +153,7 @@ class Commands
end end
# Load modules # Load modules
def load( nick, user, host, from, msg, auto = false ) def load( nick, _user, host, _from, msg, auto = false )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
_cmd, plugin = msg.split( ' ', 2 ) _cmd, plugin = msg.split( ' ', 2 )
if( plugin != nil ) if( plugin != nil )
...@@ -222,7 +222,7 @@ class Commands ...@@ -222,7 +222,7 @@ class Commands
end end
# Unload module # Unload module
def unload( nick, user, host, from, msg ) def unload( nick, _user, host, _from, msg )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
_cmd, plugin = msg.split( ' ', 2 ) _cmd, plugin = msg.split( ' ', 2 )
if( plugin != nil ) if( plugin != nil )
...@@ -282,14 +282,14 @@ class Commands ...@@ -282,14 +282,14 @@ class Commands
end end
# Meta funcion to load autoload modules # Meta funcion to load autoload modules
def autoload( nick = nil, user = nil, host = nil, from = nil, msg = nil ) def autoload( _nick = nil, _user = nil, _host = nil, _from = nil, _msg = nil )
@config.autoload.each do |mod| @config.autoload.each do |mod|
load( nil, nil, nil, nil, "dummy " + mod, true ) load( nil, nil, nil, nil, "dummy " + mod, true )
end end
end end
# Function to get list of loaded modules # Function to get list of loaded modules
def loaded( nick, user, host, from, msg ) def loaded( nick, _user, _host, _from, _msg )
if( con ) if( con )
@output.c( "Loaded plugins: " ) @output.c( "Loaded plugins: " )
@status.plugins.each_key do |plugin_name| @status.plugins.each_key do |plugin_name|
...@@ -308,7 +308,7 @@ class Commands ...@@ -308,7 +308,7 @@ class Commands
end end
# Function to list available modules # Function to list available modules
def available( nick, user, host, from, msg ) def available( nick, _user, _host, _from, _msg )
contents = Dir.entries("./" + @config.plugindir + "/" ) contents = Dir.entries("./" + @config.plugindir + "/" )
plugs = Array.new plugs = Array.new
contents.entries.each do |file| contents.entries.each do |file|
......
...@@ -22,7 +22,7 @@ class Btc ...@@ -22,7 +22,7 @@ class Btc
@bits_last = 0.0 @bits_last = 0.0
end end
def main( nick, user, host, from, msg, arguments, con ) def main( _nick, _user, _host, from, _msg, _arguments, con )
uri = URI.parse( "https://#{@bits_host}#{@bits_path}" ) uri = URI.parse( "https://#{@bits_host}#{@bits_path}" )
http = Net::HTTP.new(uri.host, uri.port) http = Net::HTTP.new(uri.host, uri.port)
...@@ -63,7 +63,7 @@ class Btc ...@@ -63,7 +63,7 @@ class Btc
end end
# Get current value # Get current value
def mtgox( nick, user, host, from, msg, arguments, con ) def mtgox( _nick, _user, _host, from, _msg, _arguments, con )
uri = URI.parse( "https://#{@api_host}#{@api_path}" ) uri = URI.parse( "https://#{@api_host}#{@api_path}" )
http = Net::HTTP.new(uri.host, uri.port) http = Net::HTTP.new(uri.host, uri.port)
...@@ -139,7 +139,7 @@ class Btc ...@@ -139,7 +139,7 @@ class Btc
end end
end end
# Get last value # Get last value
def last( nick, user, host, from, msg, arguments, con ) def last( _nick, _user, _host, from, _msg, _arguments, con )
result = JSON.parse( Net::HTTP.get( @bits_host, @bits_path ) ) result = JSON.parse( Net::HTTP.get( @bits_host, @bits_path ) )
line = "#{result[ 'last' ]}" line = "#{result[ 'last' ]}"
...@@ -152,7 +152,7 @@ class Btc ...@@ -152,7 +152,7 @@ class Btc
end end
# Get buy price # Get buy price
def buy( nick, user, host, from, msg, arguments, con ) def buy( _nick, _user, _host, from, _msg, _arguments, con )
result = JSON.parse( Net::HTTP.get( @bits_host, @bits_path ) ) result = JSON.parse( Net::HTTP.get( @bits_host, @bits_path ) )
line = "Bitstamp will buy your bitcoins for #{result[ 'bid' ]}" line = "Bitstamp will buy your bitcoins for #{result[ 'bid' ]}"
...@@ -165,7 +165,7 @@ class Btc ...@@ -165,7 +165,7 @@ class Btc
end end
# Get sell price # Get sell price
def sell( nick, user, host, from, msg, arguments, con ) def sell( _nick, _user, _host, from, _msg, _arguments, con )
result = JSON.parse( Net::HTTP.get( @bits_host, @bits_path ) ) result = JSON.parse( Net::HTTP.get( @bits_host, @bits_path ) )
line = "Bitstamp will sell you bitcoins for #{result[ 'ask' ]}" line = "Bitstamp will sell you bitcoins for #{result[ 'ask' ]}"
...@@ -178,7 +178,7 @@ class Btc ...@@ -178,7 +178,7 @@ class Btc
end end
# Get last value # Get last value
def mtgoxlast( nick, user, host, from, msg, arguments, con ) def mtgoxlast( _nick, _user, _host, from, _msg, _arguments, con )
result = JSON.parse( Net::HTTP.get( @api_host, @api_path ) ) result = JSON.parse( Net::HTTP.get( @api_host, @api_path ) )
if( result[ "result" ] != "success" ) if( result[ "result" ] != "success" )
...@@ -196,7 +196,7 @@ class Btc ...@@ -196,7 +196,7 @@ class Btc
end end
# Get buy price # Get buy price
def mtgoxbuy( nick, user, host, from, msg, arguments, con ) def mtgoxbuy( _nick, _user, _host, from, _msg, _arguments, con )
result = JSON.parse( Net::HTTP.get( @api_host, @api_path ) ) result = JSON.parse( Net::HTTP.get( @api_host, @api_path ) )
if( result[ "result" ] != "success" ) if( result[ "result" ] != "success" )
...@@ -214,7 +214,7 @@ class Btc ...@@ -214,7 +214,7 @@ class Btc
end end
# Get sell price # Get sell price
def mtgoxsell( nick, user, host, from, msg, arguments, con ) def mtgoxsell( _nick, _user, _host, from, _msg, _arguments, con )
result = JSON.parse( Net::HTTP.get( @api_host, @api_path ) ) result = JSON.parse( Net::HTTP.get( @api_host, @api_path ) )
if( result[ "result" ] != "success" ) if( result[ "result" ] != "success" )
...@@ -232,7 +232,7 @@ class Btc ...@@ -232,7 +232,7 @@ class Btc
end end
# Function to send help about this plugin (Can also be called by the help plugin.) # Function to send help about this plugin (Can also be called by the help plugin.)
def help( nick, user, host, from, msg, arguments, con ) def help( nick, _user, _host, _from, _msg, _arguments, con )
help = [ help = [
"Gets current values from mtgox", "Gets current values from mtgox",
" btc - Get bitstamp exchange rate (buying rate)", " btc - Get bitstamp exchange rate (buying rate)",
......
...@@ -13,7 +13,7 @@ class Calc ...@@ -13,7 +13,7 @@ class Calc
end end
# Default method, called when no argument is given (optional, but highly recomended) # Default method, called when no argument is given (optional, but highly recomended)
def main( nick, user, host, from, msg, arguments, con ) def main( _nick, _user, _host, from, _msg, arguments, _con )
# Check for invalid input # Check for invalid input
if( arguments =~ /^([0-9]|\.|,|\+|-|\*|\^|\/|%|\(|\)|E|pi|acos|acosh|asin|asinh|atan|atanh|cbrt|cos|cosh|erf|erfc|exp|frexp|gamma|hypot|ldexp|lgamma|log|sin|sinh|sqrt|tan|tanh| )+$/i ) if( arguments =~ /^([0-9]|\.|,|\+|-|\*|\^|\/|%|\(|\)|E|pi|acos|acosh|asin|asinh|atan|atanh|cbrt|cos|cosh|erf|erfc|exp|frexp|gamma|hypot|ldexp|lgamma|log|sin|sinh|sqrt|tan|tanh| )+$/i )
...@@ -77,7 +77,7 @@ class Calc ...@@ -77,7 +77,7 @@ class Calc
end end
# Function to send help about this plugin (Can also be called by the help plugin.) # Function to send help about this plugin (Can also be called by the help plugin.)
def help( nick, user, host, from, msg, arguments, con ) def help( nick, _user, _host, _from, _msg, _arguments, con )
help = [ help = [
"This plugin allows you to do some math.", "This plugin allows you to do some math.",
" calc 5*5 - Do some calculation.", " calc 5*5 - Do some calculation.",
......
...@@ -11,7 +11,7 @@ class Core ...@@ -11,7 +11,7 @@ class Core
end end
# Messaging commands # Messaging commands
def message( nick, user, host, from, msg, arguments, con ) def message( nick, _user, host, _from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( !arguments.nil? && !arguments.empty? ) if( !arguments.nil? && !arguments.empty? )
to, message = arguments.split( ' ', 2 ) to, message = arguments.split( ' ', 2 )
...@@ -29,7 +29,7 @@ class Core ...@@ -29,7 +29,7 @@ class Core
end end
end end
def raw( nick, user, host, from, msg, arguments, con ) def raw( nick, _user, host, _from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( !arguments.nil? && !arguments.empty? ) if( !arguments.nil? && !arguments.empty? )
@irc.raw( arguments ) @irc.raw( arguments )
...@@ -43,7 +43,7 @@ class Core ...@@ -43,7 +43,7 @@ class Core
end end
end end
def action( nick, user, host, from, msg, arguments, con ) def action( nick, _user, host, _from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( !arguments.nil? && !arguments.empty? ) if( !arguments.nil? && !arguments.empty? )
to, action = arguments.split( ' ', 2 ) to, action = arguments.split( ' ', 2 )
...@@ -61,7 +61,7 @@ class Core ...@@ -61,7 +61,7 @@ class Core
end end
end end
def notice( nick, user, host, from, msg, arguments, con ) def notice( nick, _user, host, _from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( !arguments.nil? && !arguments.empty? ) if( !arguments.nil? && !arguments.empty? )
to, message = arguments.split( ' ', 2 ) to, message = arguments.split( ' ', 2 )
...@@ -80,7 +80,7 @@ class Core ...@@ -80,7 +80,7 @@ class Core
end end
# Join/part commands # Join/part commands
def join( nick, user, host, from, msg, chan, con ) def join( nick, _user, host, _from, _msg, chan, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( !chan.nil? && !chan.empty? ) if( !chan.nil? && !chan.empty? )
@irc.join( chan ) @irc.join( chan )
...@@ -94,7 +94,7 @@ class Core ...@@ -94,7 +94,7 @@ class Core
end end
end end
def part( nick, user, host, from, msg, chan, con ) def part( nick, _user, host, _from, _msg, chan, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( !chan.nil? && !chan.empty? ) if( !chan.nil? && !chan.empty? )
@irc.part( chan ) @irc.part( chan )
...@@ -109,7 +109,7 @@ class Core ...@@ -109,7 +109,7 @@ class Core
end end
# Mode command # Mode command
def mode( nick, user, host, from, msg, arguments, con ) def mode( nick, _user, host, _from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( arguments == nil ) if( arguments == nil )
arguments = "" arguments = ""
...@@ -134,7 +134,7 @@ class Core ...@@ -134,7 +134,7 @@ class Core
end end
# Oper commands # Oper commands
def op( nick, user, host, from, msg, arguments, con ) def op( nick, _user, host, from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( arguments == nil ) if( arguments == nil )
arguments = "" arguments = ""
...@@ -161,7 +161,7 @@ class Core ...@@ -161,7 +161,7 @@ class Core
end end
end end
def deop( nick, user, host, from, msg, arguments, con ) def deop( nick, _user, host, from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( arguments == nil ) if( arguments == nil )
arguments = "" arguments = ""
...@@ -189,7 +189,7 @@ class Core ...@@ -189,7 +189,7 @@ class Core
end end
# Half-oper commands # Half-oper commands
def hop( nick, user, host, from, msg, arguments, con ) def hop( nick, _user, host, from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( arguments == nil ) if( arguments == nil )
arguments = "" arguments = ""
...@@ -216,7 +216,7 @@ class Core ...@@ -216,7 +216,7 @@ class Core
end end
end end
def dehop( nick, user, host, from, msg, arguments, con ) def dehop( nick, _user, host, from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( arguments == nil ) if( arguments == nil )
arguments = "" arguments = ""
...@@ -244,7 +244,7 @@ class Core ...@@ -244,7 +244,7 @@ class Core
end end
# Voice commands # Voice commands
def voice( nick, user, host, from, msg, arguments, con ) def voice( nick, _user, host, from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( arguments == nil ) if( arguments == nil )
arguments = "" arguments = ""
...@@ -271,7 +271,7 @@ class Core ...@@ -271,7 +271,7 @@ class Core
end end
end end
def devoice( nick, user, host, from, msg, arguments, con ) def devoice( nick, _user, host, from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( arguments == nil ) if( arguments == nil )
arguments = "" arguments = ""
...@@ -299,7 +299,7 @@ class Core ...@@ -299,7 +299,7 @@ class Core
end end
# Kick commands # Kick commands
def kick( nick, user, host, from, msg, arguments, con ) def kick( nick, _user, host, from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( !arguments.nil? && !arguments.empty? ) if( !arguments.nil? && !arguments.empty? )
if( arguments =~ /^#/ ) if( arguments =~ /^#/ )
...@@ -325,7 +325,7 @@ class Core ...@@ -325,7 +325,7 @@ class Core
end end
# Banning commands # Banning commands
def ban( nick, user, host, from, msg, arguments, con ) def ban( nick, _user, host, from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( !arguments.nil? && !arguments.empty? ) if( !arguments.nil? && !arguments.empty? )
chan, host = arguments.split( ' ', 2 ) chan, host = arguments.split( ' ', 2 )
...@@ -346,7 +346,7 @@ class Core ...@@ -346,7 +346,7 @@ class Core
end end
end end
def unban( nick, user, host, from, msg, arguments, con ) def unban( nick, _user, host, from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( !arguments.nil? && !arguments.empty? ) if( !arguments.nil? && !arguments.empty? )
chan, host = arguments.split( ' ', 2 ) chan, host = arguments.split( ' ', 2 )
...@@ -367,7 +367,7 @@ class Core ...@@ -367,7 +367,7 @@ class Core
end end
end end
def timeban( nick, user, host, from, msg, arguments, con ) def timeban( nick, _user, host, from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( @config.threads && @status.threads ) if( @config.threads && @status.threads )
if( !arguments.nil? && !arguments.empty? ) if( !arguments.nil? && !arguments.empty? )
...@@ -415,7 +415,7 @@ class Core ...@@ -415,7 +415,7 @@ class Core
end end
# Echo uptime to the user # Echo uptime to the user
def uptime( nick, user, host, from, msg, arguments, con ) def uptime( nick, _user, _host, _from, _msg, _arguments, con )
uptime = "Uptime: " + @status.uptime + "." uptime = "Uptime: " + @status.uptime + "."
if( con ) if( con )
@output.cinfo( uptime ) @output.cinfo( uptime )
...@@ -424,7 +424,7 @@ class Core ...@@ -424,7 +424,7 @@ class Core
end end
end end
def nick( nick, user, host, from, msg, arguments, con ) def nick( _nick, _user, host, _from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
if( !arguments.nil? && !arguments.empty? ) if( !arguments.nil? && !arguments.empty? )
@config.nick( arguments ) @config.nick( arguments )
......
...@@ -15,7 +15,7 @@ class Ddg ...@@ -15,7 +15,7 @@ class Ddg
end end
# Method that receives a notification when a user joins (optional) # Method that receives a notification when a user joins (optional)
def joined( nick, user, host, channel ) def joined( nick, _user, _host, channel )
if( channel == @channel ) if( channel == @channel )
@irc.mode( channel, "+v" ,nick, true ) @irc.mode( channel, "+v" ,nick, true )
end end
......
...@@ -18,7 +18,7 @@ class Debug ...@@ -18,7 +18,7 @@ class Debug
end end
# Function to send help about this plugin (Can also be called by the help plugin.) # Function to send help about this plugin (Can also be called by the help plugin.)
def help( nick, user, host, from, msg, arguments, con ) def help( nick, _user, _host, _from, _msg, _arguments, con )
help = [ help = [
"Plugin to help with debugging.", "Plugin to help with debugging.",
" debug threadlist - Print list of threads to console.", " debug threadlist - Print list of threads to console.",
...@@ -38,7 +38,7 @@ class Debug ...@@ -38,7 +38,7 @@ class Debug
end end
# Show backtrace of specific thread # Show backtrace of specific thread
def threadtrace( nick, user, host, from, msg, arguments, con ) def threadtrace( _nick, _user, _host, _from, _msg, arguments, _con )
Thread.list.each do |thr| Thread.list.each do |thr|
if( thr.to_s =~ /#{arguments}/ ) if( thr.to_s =~ /#{arguments}/ )
thr.backtrace.each do |level| thr.backtrace.each do |level|
...@@ -51,7 +51,7 @@ class Debug ...@@ -51,7 +51,7 @@ class Debug
# List all threads + status # List all threads + status
def threadlist( nick, user, host, from, msg, arguments, con ) def threadlist( _nick, _user, _host, _from, _msg, _arguments, _con )
Thread.list.each do |thr| Thread.list.each do |thr|
@output.info( "#{thr.inspect}\n" ) @output.info( "#{thr.inspect}\n" )
end end
...@@ -59,7 +59,7 @@ class Debug ...@@ -59,7 +59,7 @@ class Debug
end end
# Kill thread # Kill thread
def threadkill( nick, user, host, from, msg, arguments, con ) def threadkill( nick, _user, host, from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
Thread.list.each do |thr| Thread.list.each do |thr|
if( thr.to_s =~ /#{arguments}/ ) if( thr.to_s =~ /#{arguments}/ )
...@@ -72,7 +72,7 @@ class Debug ...@@ -72,7 +72,7 @@ class Debug
end end
# Set debug level # Set debug level
def level( nick, user, host, from, msg, arguments, con ) def level( nick, _user, host, from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )
@status.debug( arguments.to_i ) @status.debug( arguments.to_i )
@irc.notice( nick, "Set debug level to #{arguments}" ) @irc.notice( nick, "Set debug level to #{arguments}" )
......
...@@ -14,12 +14,12 @@ class Delay ...@@ -14,12 +14,12 @@ class Delay
end end
# Default method # Default method
def main( nick, user, host, from, msg, arguments, con ) def main( nick, _user, _host, _from, _msg, _arguments, _con )
@irc.notice( nick, "Use 'ruby' or 'irc' as the method.") @irc.notice( nick, "Use 'ruby' or 'irc' as the method.")
end end
# Function to send help about this plugin (Can also be called by the help plugin.) # Function to send help about this plugin (Can also be called by the help plugin.)
def help( nick, user, host, from, msg, arguments, con ) def help( nick, _user, _host, _from, _msg, _arguments, con )
help = [ help = [
"This plugin to delay actions.", "This plugin to delay actions.",
" delay ruby [seconds] [action] - Set ruby command to be carried out later." " delay ruby [seconds] [action] - Set ruby command to be carried out later."
...@@ -36,7 +36,7 @@ class Delay ...@@ -36,7 +36,7 @@ class Delay
end end
# Functions to do delayed actions # Functions to do delayed actions
def ruby( nick, user, host, from, msg, arguments, con ) def ruby( _nick, _user, host, from, _msg, arguments, con )
if( @config.auth( host, con ) ) if( @config.auth( host, con ) )