diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7677f8ffb23ebfcbfb5ee25788609eaad6528a28..cd80421bae6c6554ec678d8bd19f8afae6d7be94 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -73,4 +73,4 @@ rubocop: - ruby script: - 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 diff --git a/commands.rb b/commands.rb index 512cdcfed8f633c51bde202f62eefe19a9fc9a70..56192782b07d0c31b7aca1909fb567656ddd02b1 100644 --- a/commands.rb +++ b/commands.rb @@ -123,7 +123,7 @@ class Commands end # Quit command - def quit( nick, user, host, from, msg ) + def quit( _nick, _user, host, _from, msg ) if( @config.auth( host, con ) ) if( con ) @output.cbad( "This will also stop the bot, are you sure? [y/N]: " ) @@ -153,7 +153,7 @@ class Commands end # 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 ) ) _cmd, plugin = msg.split( ' ', 2 ) if( plugin != nil ) @@ -222,7 +222,7 @@ class Commands end # Unload module - def unload( nick, user, host, from, msg ) + def unload( nick, _user, host, _from, msg ) if( @config.auth( host, con ) ) _cmd, plugin = msg.split( ' ', 2 ) if( plugin != nil ) @@ -282,14 +282,14 @@ class Commands end # 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| load( nil, nil, nil, nil, "dummy " + mod, true ) end end # Function to get list of loaded modules - def loaded( nick, user, host, from, msg ) + def loaded( nick, _user, _host, _from, _msg ) if( con ) @output.c( "Loaded plugins: " ) @status.plugins.each_key do |plugin_name| @@ -308,7 +308,7 @@ class Commands end # Function to list available modules - def available( nick, user, host, from, msg ) + def available( nick, _user, _host, _from, _msg ) contents = Dir.entries("./" + @config.plugindir + "/" ) plugs = Array.new contents.entries.each do |file| diff --git a/plugins/btc.rb b/plugins/btc.rb index bbc594b503ced247c0f5541cd8ecbf28d9720cb7..7ac985b694fbb9f9d336f47afd0f6571fab7ea95 100644 --- a/plugins/btc.rb +++ b/plugins/btc.rb @@ -22,7 +22,7 @@ class Btc @bits_last = 0.0 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}" ) http = Net::HTTP.new(uri.host, uri.port) @@ -63,7 +63,7 @@ class Btc end # 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}" ) http = Net::HTTP.new(uri.host, uri.port) @@ -139,7 +139,7 @@ class Btc end end # 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 ) ) line = "#{result[ 'last' ]}" @@ -152,7 +152,7 @@ class Btc end # 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 ) ) line = "Bitstamp will buy your bitcoins for #{result[ 'bid' ]}" @@ -165,7 +165,7 @@ class Btc end # 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 ) ) line = "Bitstamp will sell you bitcoins for #{result[ 'ask' ]}" @@ -178,7 +178,7 @@ class Btc end # 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 ) ) if( result[ "result" ] != "success" ) @@ -196,7 +196,7 @@ class Btc end # 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 ) ) if( result[ "result" ] != "success" ) @@ -214,7 +214,7 @@ class Btc end # 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 ) ) if( result[ "result" ] != "success" ) @@ -232,7 +232,7 @@ class Btc end # 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 = [ "Gets current values from mtgox", " btc - Get bitstamp exchange rate (buying rate)", diff --git a/plugins/calc.rb b/plugins/calc.rb index efd830bd4232587e20483bf75778eb20207b0e1e..096c531f82b980fa3542ffb3e589f9d030219900 100644 --- a/plugins/calc.rb +++ b/plugins/calc.rb @@ -13,7 +13,7 @@ class Calc end # 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 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 end # 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 = [ "This plugin allows you to do some math.", " calc 5*5 - Do some calculation.", diff --git a/plugins/core.rb b/plugins/core.rb index 20c33869c44f65ffc6f48460a53c8f864560df3c..14cd0084a139364545092f1c287806a92335842e 100644 --- a/plugins/core.rb +++ b/plugins/core.rb @@ -11,7 +11,7 @@ class Core end # 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( !arguments.nil? && !arguments.empty? ) to, message = arguments.split( ' ', 2 ) @@ -29,7 +29,7 @@ class Core 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( !arguments.nil? && !arguments.empty? ) @irc.raw( arguments ) @@ -43,7 +43,7 @@ class Core 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( !arguments.nil? && !arguments.empty? ) to, action = arguments.split( ' ', 2 ) @@ -61,7 +61,7 @@ class Core 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( !arguments.nil? && !arguments.empty? ) to, message = arguments.split( ' ', 2 ) @@ -80,7 +80,7 @@ class Core end # 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( !chan.nil? && !chan.empty? ) @irc.join( chan ) @@ -94,7 +94,7 @@ class Core 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( !chan.nil? && !chan.empty? ) @irc.part( chan ) @@ -109,7 +109,7 @@ class Core end # 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( arguments == nil ) arguments = "" @@ -134,7 +134,7 @@ class Core end # 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( arguments == nil ) arguments = "" @@ -161,7 +161,7 @@ class Core 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( arguments == nil ) arguments = "" @@ -189,7 +189,7 @@ class Core end # 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( arguments == nil ) arguments = "" @@ -216,7 +216,7 @@ class Core 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( arguments == nil ) arguments = "" @@ -244,7 +244,7 @@ class Core end # 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( arguments == nil ) arguments = "" @@ -271,7 +271,7 @@ class Core 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( arguments == nil ) arguments = "" @@ -299,7 +299,7 @@ class Core end # 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( !arguments.nil? && !arguments.empty? ) if( arguments =~ /^#/ ) @@ -325,7 +325,7 @@ class Core end # 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( !arguments.nil? && !arguments.empty? ) chan, host = arguments.split( ' ', 2 ) @@ -346,7 +346,7 @@ class Core 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( !arguments.nil? && !arguments.empty? ) chan, host = arguments.split( ' ', 2 ) @@ -367,7 +367,7 @@ class Core 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.threads && @status.threads ) if( !arguments.nil? && !arguments.empty? ) @@ -415,7 +415,7 @@ class Core end # 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 + "." if( con ) @output.cinfo( uptime ) @@ -424,7 +424,7 @@ class Core 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( !arguments.nil? && !arguments.empty? ) @config.nick( arguments ) diff --git a/plugins/ddg.rb b/plugins/ddg.rb index aa43041d7a130ab52b5392c45310e3ce0e429ce0..1519504631bf2aa2793342e1a86978bc4bfcf308 100644 --- a/plugins/ddg.rb +++ b/plugins/ddg.rb @@ -15,7 +15,7 @@ class Ddg end # 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 ) @irc.mode( channel, "+v" ,nick, true ) end diff --git a/plugins/debug.rb b/plugins/debug.rb index bf5b88646c084be4cfd229f9db8d18ffeed54bc5..6106d0049cf6545a139963d41343f0998476e167 100644 --- a/plugins/debug.rb +++ b/plugins/debug.rb @@ -18,7 +18,7 @@ class Debug end # 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 = [ "Plugin to help with debugging.", " debug threadlist - Print list of threads to console.", @@ -38,7 +38,7 @@ class Debug end # 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| if( thr.to_s =~ /#{arguments}/ ) thr.backtrace.each do |level| @@ -51,7 +51,7 @@ class Debug # 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| @output.info( "#{thr.inspect}\n" ) end @@ -59,7 +59,7 @@ class Debug end # 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 ) ) Thread.list.each do |thr| if( thr.to_s =~ /#{arguments}/ ) @@ -72,7 +72,7 @@ class Debug end # 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 ) ) @status.debug( arguments.to_i ) @irc.notice( nick, "Set debug level to #{arguments}" ) diff --git a/plugins/delay.rb b/plugins/delay.rb index bad017652c1960b58e58eae4fab8036256c890e7..a965cc0436aac1e540336980bd632ac1e0610182 100644 --- a/plugins/delay.rb +++ b/plugins/delay.rb @@ -14,12 +14,12 @@ class Delay end # 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.") end # 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 = [ "This plugin to delay actions.", " delay ruby [seconds] [action] - Set ruby command to be carried out later." @@ -36,7 +36,7 @@ class Delay end # 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( !arguments.nil? && !arguments.empty? ) delay, action = arguments.split( ' ', 2 ) diff --git a/plugins/demo.rb b/plugins/demo.rb index 8943bce728444f9cbf3c82ea9edc2c69e3393afb..e50dcb0fb559a57cd116376f0a5bf2d7ce5f189a 100644 --- a/plugins/demo.rb +++ b/plugins/demo.rb @@ -20,39 +20,39 @@ class Demo end # 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 ) @irc.message( from, "This is the demo module, function, function_admin and remote are availble." ) end # Method that receives a notification when a user is kicked (optional) - def kicked( nick, user, host, channel, kicked, reason ) + def kicked( nick, _user, _host, channel, kicked, reason ) @irc.message( channel, kicked + " was kicked by " + nick + " for " + reason + "." ) end # Method that receives a notification when a notice is received (optional) - def noticed( nick, user, host, to, message ) + def noticed( nick, _user, _host, _to, message ) @irc.message( nick, "Received notice from: " + nick + ": " + message ) end # Method that receives a notification when a message is received, that is not a command (optional) - def messaged( nick, user, host, from, message ) + def messaged( nick, _user, _host, from, message ) if( @config.nick != nick ) @irc.message( from, "Received message from: " + nick + ": " + message ) end end # Method that receives a notification when a user joins (optional) - def joined( nick, user, host, channel ) + def joined( nick, _user, _host, channel ) @irc.message( channel, nick + " joined " + channel + "." ) end # Method that receives a notification when a user parts (optional) - def parted( nick, user, host, channel ) + def parted( nick, _user, _host, channel ) @irc.message( channel, nick + " parted " + channel + "." ) end # Method that receives a notification when a user quits (optional) - def quited( nick, user, host, message ) + def quited( nick, _user, _host, message ) @output.std( nick + " quit: " + message ) end @@ -72,7 +72,7 @@ class Demo end # 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 = [ "This plugin demonstrates the working of plugins.", " demo function - Public plugin function.", @@ -90,12 +90,12 @@ class Demo end # Generic function that can be called by any user - def function( nick, user, host, from, msg, arguments, con ) + def function( nick, _user, _host, from, _msg, _arguments, _con ) @irc.message( from, nick + " called \"function\" from " + from + "." ) end # Generic function that can only be called by an admin - def functionadmin( nick, user, host, from, msg, arguments, con ) + def functionadmin( nick, _user, host, from, _msg, _arguments, con ) if( @config.auth( host, con ) ) # Admin only code goes in here @irc.message( from, nick + " called \"function_admin\" from " + from + "." ) diff --git a/plugins/dogecoin.rb b/plugins/dogecoin.rb index 75dd5176efbfbc05a6da895948c5e81af455b174..4989a6e0bc08beef1d0796a74e8af371885e5135 100644 --- a/plugins/dogecoin.rb +++ b/plugins/dogecoin.rb @@ -21,7 +21,7 @@ class Dogecoin end # Alias for last - def main( nick, user, host, from, msg, arguments, con ) + def main( _nick, _user, _host, from, _msg, _arguments, con ) uri = URI.parse( "http://#{@api_host}#{@api_path}" ) http = Net::HTTP.new( uri.host, uri.port ) @@ -54,7 +54,7 @@ class Dogecoin end # 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 = [ "Gets current litecoin values from Btc-e", " dogecoin - Get DOGE/BTC exchange rate" diff --git a/plugins/git.rb b/plugins/git.rb index 334634693e04ef05e97ce4753bc1bd280a53cb44..c2b2be8a816e7b32aba7418a4b050e96a26b43af 100644 --- a/plugins/git.rb +++ b/plugins/git.rb @@ -18,7 +18,7 @@ class Git end # 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 = [ "This plugin allows you to pull updates from a git repo.", "Will only work if you cloned the bot from git.", @@ -37,7 +37,7 @@ class Git end # Pull updates from server - def pull( nick, user, host, from, msg, arguments, con ) + def pull( nick, _user, host, _from, _msg, _arguments, con ) if( @config.auth( host, con ) ) res = %x( git pull ).gsub!( "\n", " " ) @irc.notice( nick, "#{res}" ) @@ -45,7 +45,7 @@ class Git end # Show some output and status - def status( nick, user, host, from, msg, arguments, con ) + def status( nick, _user, _host, _from, _msg, _arguments, _con ) branch = %x( git branch | head -n 1 | awk '{print $2}' ) status = %x( git fetch -v --dry-run 2>&1 >/dev/null | grep #{branch} ) diff --git a/plugins/hackerthreads.rb b/plugins/hackerthreads.rb index e93a2b3838fa503d823dd2461151526130460517..30e39d861540737802aae4126965dda008ece3c8 100644 --- a/plugins/hackerthreads.rb +++ b/plugins/hackerthreads.rb @@ -47,7 +47,7 @@ class Hackerthreads end # Default method - def main( nick, user, host, from, msg, arguments, con ) + def main( _nick, _user, _host, _from, _msg, _arguments, _con ) check_rss end private diff --git a/plugins/identified.rb b/plugins/identified.rb index 10c1b9142cd5a5c8ac0d914a10e4fd127e2aad9c..7fea2dfb8108a0981a0c00dd2a25ba929a83e0fc 100644 --- a/plugins/identified.rb +++ b/plugins/identified.rb @@ -15,14 +15,14 @@ class Identified end # 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 ) @irc.message( "NickServ", "status " + nick ) end end # Method that receives a notification when a notice is received (optional) - def noticed( nick, user, host, to, message ) + def noticed( nick, _user, _host, _to, message ) nick.downcase! if( nick == "nickserv" ) _cmd, subject, status = message.split( ' ', 3 ) @@ -34,7 +34,7 @@ class Identified end # 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 ) if( con ) @output.c( "Plugin to voice users that have identified with NickServ.\n" ) else diff --git a/plugins/kamikaze.rb b/plugins/kamikaze.rb index c9a138399200b8ac6bb3e3386eb10b79672b292a..238a63ea2f181d3167e06def2ce829b3cd0a4e01 100644 --- a/plugins/kamikaze.rb +++ b/plugins/kamikaze.rb @@ -37,7 +37,7 @@ class Kamikaze end # Help method - def help( nick, user, host, from, msg, arguments, con ) + def help( nick, _user, _host, _from, _msg, _arguments, con ) help = [ "This module provides the ability to kick other users, but at a terrible price!", " kamikaze [user] - Kick a user.", diff --git a/plugins/login.rb b/plugins/login.rb index 32f32af2db85e6969db2eb3586d97bcb5cb1d942..4f62bf3727cf5e0ce0d599498355340008414fcf 100644 --- a/plugins/login.rb +++ b/plugins/login.rb @@ -50,7 +50,7 @@ class Login end # Function to set password - def set( nick, user, host, from, msg, arguments, con ) + def set( _nick, _user, host, _from, _msg, arguments, con ) if( @config.auth( host, con ) ) if( !arguments.nil? && !arguments.empty? ) @password = BCrypt::Password.create arguments @@ -60,7 +60,7 @@ class Login end # 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 = [ "This plugin allows users to log in with a password when their hostmask is not in the oper list.", " login [password] - Login with password.", diff --git a/plugins/ltc.rb b/plugins/ltc.rb index 85ace500eb992c31c80bf7daf41e8b06c866c4d1..4111ad23172314c58a056c0bd5a80e6a0f841eaf 100644 --- a/plugins/ltc.rb +++ b/plugins/ltc.rb @@ -20,7 +20,7 @@ class Ltc end # Alias for last - def main( nick, user, host, from, msg, arguments, con ) + def main( _nick, _user, _host, from, _msg, _arguments, con ) uri = URI.parse( "https://#{@api_host}#{@api_path}" ) http = Net::HTTP.new(uri.host, uri.port) @@ -68,7 +68,7 @@ class Ltc end # 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 = [ "Gets current litecoin values from Btc-e", " btc - Get Btc-e exchange rate (buying rate)" diff --git a/plugins/memo.rb b/plugins/memo.rb index b971cca6a57ed289fcc8886a1c0109e6f6c2641c..5a15a8f7029aa0a6d0b37554d915752674200e3b 100644 --- a/plugins/memo.rb +++ b/plugins/memo.rb @@ -76,7 +76,7 @@ class Memo end # Send memo to user - def send( nick, user, host, from, msg, arguments, con ) + def send( nick, _user, _host, _from, msg, arguments, con ) if( !arguments.nil? && !arguments.empty? ) arguments = arguments.split() @@ -111,7 +111,7 @@ class Memo end # Read memos - def read( nick, user, host, from, msg, arguments, con, print = true ) + def read( nick, _user, _host, _from, _msg, arguments, con, print = true ) nick = nick.downcase.to_s.encode('utf-8') count = @recordcount.execute( :receiver => nick ).next[0] @@ -192,7 +192,7 @@ class Memo end # Output some plugin state - def status( nick, user, host, from, msg, arguments, con ) + def status( nick, _user, _host, _from, _msg, _arguments, con ) warmup = ( @cache.size.to_f / @maxcache.to_f ) * 100 warmup = ( warmup * 10 ).round / 10.0 @@ -206,7 +206,7 @@ class Memo end # 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 = [ "Send and read memos", " memo send [user] [message] - Send memo to a user.", @@ -237,7 +237,7 @@ class Memo end # Check if user is alive - def messaged( nick, user, host, from, message ) + def messaged( nick, _user, _host, from, _message ) @output.debug("messaged\n") nick = nick.downcase.to_s.encode('utf-8') diff --git a/plugins/mibs.rb b/plugins/mibs.rb index 0d53177d29e0d61dcc9f5d1d4def8b62a124d12c..27304c62e9e28ae187e3fb597676d112fe1cfae7 100644 --- a/plugins/mibs.rb +++ b/plugins/mibs.rb @@ -63,7 +63,7 @@ class Mibs end # Check if mib has been here before on join - def joined( nick, user, host, channel ) + def joined( nick, user, _host, _channel ) # See if user looks like mib if( user =~ /^[0-9a-f]{8}/ ) nick = nick.to_s.encode('utf-8') @@ -99,7 +99,7 @@ class Mibs end # Retreive record - def getrecord( nick, user, host, from, msg, arguments, con ) + def getrecord( _nick, _user, host, from, _msg, arguments, con ) if( @config.auth( host, con ) ) line = @getrecord.execute( :hexip => arguments ).next.inspect @@ -111,7 +111,7 @@ class Mibs end end - def searchnote( nick, user, host, from, msg, arguments, con ) + def searchnote( _nick, _user, host, from, _msg, arguments, con ) if( @config.auth( host, con ) ) line = @searchnote.execute( :searchterm => arguments ).next.inspect @@ -123,7 +123,7 @@ class Mibs end end - def writenote( nick, user, host, from, msg, arguments, con ) + def writenote( _nick, _user, host, _from, _msg, arguments, con ) if( @config.auth( host, con ) ) arguments = arguments.split() @@ -152,7 +152,7 @@ class Mibs end # 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 = [ "Keep track of mibbit users", " mibs getrecord [hexip] - Get DB line.", diff --git a/plugins/netsplit.rb b/plugins/netsplit.rb index 451db20fd829ea24c995ad4acf2f6bf44fc22f0e..65428ebd1ad6bdba1a59e57204857e7f8c6c2364 100644 --- a/plugins/netsplit.rb +++ b/plugins/netsplit.rb @@ -57,12 +57,12 @@ class Netsplit end # Display non-interactivity messages - def main( nick, user, host, from, msg, arguments, con ) + def main( _nick, _user, _host, from, _msg, _arguments, _con ) @irc.message( from, "This plugin is not interactive." ) end # Capture MAP response - def servermsg( servername, messagenumber, message ) + def servermsg( _servername, messagenumber, message ) # Check if message is MAP type if( messagenumber == "006" ) @@ -83,7 +83,7 @@ class Netsplit end # 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 = [ "This plugin keeps track and attempts to recover from netsplits." ] @@ -99,7 +99,7 @@ class Netsplit end # Callback function for when we did not receive enough servers - def timeout( nick, user, host, from, msg, arguments, con ) + def timeout( nick, _user, _host, _from, _msg, _arguments, _con ) # Make sure this function is not being called from IRC if( nick != nil ) diff --git a/plugins/paste.rb b/plugins/paste.rb index 7bd754320109f4229777b7ab208037ffda2cb6d8..f529533252492eb836c4013171a10ce1c4233e86 100644 --- a/plugins/paste.rb +++ b/plugins/paste.rb @@ -18,7 +18,7 @@ class Paste end # 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 ) params = { 'type' => msg, @@ -31,7 +31,7 @@ class Paste end # 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 = [ "This plugin uploads text that's too long to output in IRC. Not interactive." ] diff --git a/plugins/search.rb b/plugins/search.rb index 441ebb6f3b247e8cf8b99cff23511ec1502d19ae..5f1ca1e80b9766cbef9f0116f14f2e209ab1d24d 100644 --- a/plugins/search.rb +++ b/plugins/search.rb @@ -36,7 +36,7 @@ class Search end #This method searches google for given arguments and returns a result if found. - def google( nick, user, host, from, msg, arguments, con ) + def google( _nick, _user, _host, from, _msg, arguments, con ) if( !arguments.nil? && !arguments.empty? ) arguments.gsub!( / /, "+" ) # Sanitize search request # Retreive JSON @@ -62,7 +62,7 @@ class Search end # Function to search book titles by ISBN number - def isbn( nick, user, host, from, msg, arguments, con ) + def isbn( _nick, _user, _host, from, _msg, arguments, con ) if( !arguments.nil? && !arguments.empty? ) arguments.gsub!( /[^0-9\-]/, "" ) # Sanitize ISBN number @@ -85,7 +85,7 @@ class Search end # 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 = [ "This plugin searches something", " search google [query] - Find someting using Google", diff --git a/plugins/seen.old.rb b/plugins/seen.old.rb index 8bce4f99b048c79a0c2a8e609e1815aa8605bb2c..6647f044ba701f53f2b0f12e1524d496712460ac 100644 --- a/plugins/seen.old.rb +++ b/plugins/seen.old.rb @@ -74,7 +74,7 @@ class Seen end # Grab last seen - def last( nick, user, host, from, msg, arguments, con ) + def last( _nick, _user, _host, from, _msg, arguments, con ) # Declare result string line = [ "" ] @@ -107,7 +107,7 @@ class Seen end # Grab beforelast seen - def beforelast( nick, user, host, from, msg, arguments, con ) + def beforelast( _nick, _user, _host, from, _msg, arguments, con ) # Declare result string line = [ "" ] @@ -140,42 +140,42 @@ class Seen end # Add regular message to seen database - def messaged( nick, user, host, from, message ) + def messaged( nick, _user, _host, from, message ) line = nick + " on " + from + ": " + message tmp = nick.downcase add( tmp, line ) end # Add kick to seen database - def kicked( nick, user, host, channel, kicked, reason ) + def kicked( nick, _user, _host, channel, kicked, reason ) line = kicked + " was kicked from " + channel + " by " + nick + " (" + reason + ")." tmp = kicked.downcase add( tmp, line ) end # Add join to seen database - def joined( nick, user, host, channel ) + def joined( nick, _user, _host, channel ) line = nick + " joined " + channel tmp = nick.downcase add( tmp, line ) end # Add part to seen database - def parted( nick, user, host, channel ) + def parted( nick, _user, _host, channel ) line = nick + " parted " + channel tmp = nick.downcase add( tmp, line ) end # Add quit to seen database - def quited( nick, user, host, message ) + def quited( nick, _user, _host, message ) line = nick + " quit (" + message + ")" tmp = nick.downcase add( tmp, line ) end # Meta function to force write - def write( nick, user, host, from, msg, arguments, con ) + def write( nick, _user, host, _from, _msg, _arguments, con ) if( @config.auth( host, con ) ) write_db @@ -188,7 +188,7 @@ class Seen end # 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 = [ "This plugin provides data on the last seen times and actions of users.", " seen last [user] - Provides the last seen action from a user.", diff --git a/plugins/seen.rb b/plugins/seen.rb index 97bd0f7584e90e6655007d99c6caa8a4d569b26b..e487eeb9b980e44f8a083c7b708e0e40c3e7e10d 100644 --- a/plugins/seen.rb +++ b/plugins/seen.rb @@ -125,7 +125,7 @@ class Seen end # Main function for plugin - def main( nick, user, host, from, msg, arguments, con ) + def main( _nick, _user, _host, from, _msg, arguments, con ) @output.debug("main\n") # Declare result string @@ -279,7 +279,7 @@ class Seen end # Function that shows some statistics - def stats( nick, user, host, from, msg, arguments, con ) + def stats( _nick, _user, _host, from, _msg, _arguments, con ) rows = "" @mutex.synchronize { rows = @db.execute( @recordcount ) @@ -307,7 +307,7 @@ class Seen end # Function to force database write - def write( nick, user, host, from, msg, arguments, con ) + def write( nick, _user, host, _from, _msg, _arguments, con ) if( @config.auth( host, con ) ) db_write @@ -320,7 +320,7 @@ class Seen end # Search for nicknames in the database - def search( nick, user, host, from, msg, arguments, con ) + def search( _nick, _user, _host, from, _msg, arguments, con ) # Ensure all nicks are also in the database db_write @@ -340,7 +340,7 @@ class Seen end # 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 = [ "This plugin provides data on the last seen times and actions of users.", " seen [user] - Provides the last seen action from a user.", @@ -374,7 +374,7 @@ class Seen end # Data gathering functions - def messaged( nick, user, host, from, message ) + def messaged( nick, _user, _host, from, message ) @output.debug("messaged\n") # Check if it's not a private message to the bot. @@ -383,22 +383,22 @@ class Seen end end - def joined( nick, user, host, channel ) + def joined( nick, _user, _host, channel ) @output.debug("joined\n") update_data( Datastore.new( nick, nil, nil, nil, nil, nil, "Joined #{channel}", Time.now.to_i ) ) end - def parted( nick, user, host, channel ) + def parted( nick, _user, _host, channel ) @output.debug("parted\n") update_data( Datastore.new( nick, nil, nil, nil, nil, nil, "Parted #{channel}", Time.now.to_i ) ) end - def quited( nick, user, host, message ) + def quited( nick, _user, _host, message ) @output.debug("quited\n") update_data( Datastore.new( nick, nil, nil, nil, nil, nil, "Quit: #{message}", Time.now.to_i ) ) end - def kicked( nick, user, host, channel, kicked, reason ) + def kicked( nick, _user, _host, channel, _kicked, reason ) @output.debug("kicked\n") update_data( Datastore.new( nick, nil, nil, nil, nil, nil, "Kicked from #{channel}: #{reason}", Time.now.to_i ) ) end diff --git a/plugins/shells.rb b/plugins/shells.rb index 4cab2301056cab14362441502e599cb59e6c6b98..b1ac4d018ea60fb1534a5ff0913806d0f10b3beb 100644 --- a/plugins/shells.rb +++ b/plugins/shells.rb @@ -15,7 +15,7 @@ class Shells end # Main method - def main( nick, user, host, from, msg, arguments, con ) + def main( nick, _user, _host, _from, _msg, _arguments, con ) line = "Invalid input. Use the help function to check available commands." if( con ) @output.c( line + "\n" ) @@ -25,7 +25,7 @@ class Shells end # Method for parsing standard messages - def messaged( nick, user, host, from, message ) + def messaged( nick, _user, _host, from, message ) # Check for right channel if( from == @chan ) # Check for exempted uses @@ -42,7 +42,7 @@ class Shells end # Method that receives a notification when a user joins - def joined( nick, user, host, channel ) + def joined( nick, _user, _host, channel ) if( channel == @chan ) @irc.notice( nick, "Hello #{nick}, welcome to #shells for Insomnia 24/7 shell support."); @irc.notice( nick, "If no one is here to help you, please stick around or email your questions to coolfire\@insomnia247.nl."); @@ -56,7 +56,7 @@ class Shells # Show links - def link( nick, user, host, from, msg, arguments, con ) + def link( _nick, _user, _host, from, _msg, arguments, con ) case arguments when /^main/i info = [ "http://wiki.insomnia247.nl/wiki/Shells" ] @@ -101,7 +101,7 @@ class Shells def port( nick, user, host, from, msg, arguments, con ) ports( nick, user, host, from, msg, arguments, con ) end - def ports( nick, user, host, from, msg, arguments, con ) + def ports( _nick, _user, _host, from, _msg, _arguments, con ) info = [ "Our shells have ports 5000 to 5500 open for incoming connections.", "The port command can be used from your shell to determime which ports are available to you.", @@ -116,7 +116,7 @@ class Shells def website( nick, user, host, from, msg, arguments, con ) websites( nick, user, host, from, msg, arguments, con ) end - def websites( nick, user, host, from, msg, arguments, con ) + def websites( _nick, _user, _host, from, _msg, _arguments, con ) info = [ "Our shells allow you to host a small website on your shell.", "You need to put your websites files in the public_html folder on your shell.", @@ -130,7 +130,7 @@ class Shells def backup( nick, user, host, from, msg, arguments, con ) backups( nick, user, host, from, msg, arguments, con ) end - def backups( nick, user, host, from, msg, arguments, con ) + def backups( _nick, _user, _host, from, _msg, _arguments, con ) info = [ "You can use the backup command on your shell to backup or restore files from or to our off-site backup.", "Full backups of the home directories are made every Monday, Wednesday and Friday at 5:40am local time.", @@ -143,7 +143,7 @@ class Shells end # Show information about ZNC. - def znc( nick, user, host, from, msg, arguments, con ) + def znc( _nick, _user, _host, from, _msg, _arguments, con ) info = [ "You can find a guide to setting up ZNC for your shell here: http://wiki.insomnia247.nl/wiki/Shells_ZNC" ] @@ -151,7 +151,7 @@ class Shells end # 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 = [ "This plugin provides several functions to support " + @chan + ".", " shells link [topic] - Show link to wiki.", @@ -178,41 +178,41 @@ class Shells end # Stats functions - def uptime( nick, user, host, from, msg, arguments, con ) + def uptime( _nick, _user, _host, from, _msg, _arguments, _con ) getstat( from, "uptime" ) end - def users( nick, user, host, from, msg, arguments, con ) + def users( _nick, _user, _host, from, _msg, _arguments, _con ) getstat( from, "users" ) end - def online( nick, user, host, from, msg, arguments, con ) + def online( _nick, _user, _host, from, _msg, _arguments, _con ) getstat( from, "ousers" ) end - def month( nick, user, host, from, msg, arguments, con ) + def month( _nick, _user, _host, from, _msg, _arguments, _con ) getstat( from, "numusers" ) end - def load( nick, user, host, from, msg, arguments, con ) + def load( _nick, _user, _host, from, _msg, _arguments, _con ) getstat( from, "load" ) end - def kernel( nick, user, host, from, msg, arguments, con ) + def kernel( _nick, _user, _host, from, _msg, _arguments, _con ) getstat( from, "kernel" ) end - def twofactor( nick, user, host, from, msg, arguments, con ) + def twofactor( _nick, _user, _host, from, _msg, _arguments, _con ) getstat( from, "twofactor" ) end # Command to check if there are unvoiced users that should have voice - def voice( nick, user, host, from, msg, arguments, con ) + def voice( _nick, _user, _host, _from, _msg, _arguments, _con ) @irc.raw("NAMES #{@chan}") end # Capture names results - def servermsg( servername, messagenumber, message ) + def servermsg( _servername, messagenumber, message ) if( messagenumber == '353' ) parts = message.split(':') if(parts[0] == "#{@config.nick} = #{@chan} ") diff --git a/plugins/socketmessage.rb b/plugins/socketmessage.rb index 8fd458fe382717980c6882917c1743a9c697d2b2..c8868b5c858e4e53e7077278d941d195c5018ca3 100644 --- a/plugins/socketmessage.rb +++ b/plugins/socketmessage.rb @@ -25,7 +25,7 @@ class Socketmessage return true end - def help( nick, user, host, from, msg, arguments, con ) + def help( nick, _user, _host, _from, _msg, _arguments, con ) line = 'This plugin gets messages from a local socket. No interactive commands available' if( con ) diff --git a/plugins/svn.rb b/plugins/svn.rb index bcf591ac840ab7b358f8c84efe0f81d72e2d1a04..0402510d54b3dea9c1d91bc2b92afd23cc459e14 100644 --- a/plugins/svn.rb +++ b/plugins/svn.rb @@ -18,7 +18,7 @@ class Svn end # 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 = [ "This plugin allows you to pull updates from the svn repo.", "Will only work if you checked the bot out from svn.", @@ -37,7 +37,7 @@ class Svn end # Function to get updates from SVN - def update( nick, user, host, from, msg, arguments, con ) + def update( nick, _user, host, _from, _msg, _arguments, con ) if( @config.auth( host, con ) ) res = %x( svn up ).gsub!( "\n", " " ) @irc.notice( nick, "#{res}" ) @@ -45,7 +45,7 @@ class Svn end # Function to check revision - def version( nick, user, host, from, msg, arguments, con ) + def version( nick, _user, _host, _from, _msg, _arguments, _con ) res = %x( svnversion ).gsub!( "\n", " " ) @irc.notice( nick, "#{res}" ) end diff --git a/plugins/tinyurl.rb b/plugins/tinyurl.rb index e597d5869c2eeb679df5c869e969f84b28410020..78568741633aff563c610deb94ca782ee0bf92ba 100644 --- a/plugins/tinyurl.rb +++ b/plugins/tinyurl.rb @@ -13,7 +13,7 @@ class Tinyurl end # 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 ) if( !arguments.nil? && !arguments.empty? ) if( arguments !~ /tinyurl/ ) line = Net::HTTP.get( 'tinyurl.com', '/api-create.php?url=' + arguments ) diff --git a/plugins/title.rb b/plugins/title.rb index a4c0017cd876c3052743f9b8e2ea6aa7505d3d75..86a07c8ffbd8168200180b8633d6716a2aa34a22 100644 --- a/plugins/title.rb +++ b/plugins/title.rb @@ -21,7 +21,7 @@ class Title end # 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 ) response = getTitle( arguments, true ) @irc.message( from, response ) end @@ -72,7 +72,7 @@ class Title end # Function to turn on/off showing type/size info for common image types - def commonimages( nick, user, host, from, msg, arguments, con ) + def commonimages( _nick, _user, host, from, _msg, _arguments, con ) if( @config.auth( host, con ) ) @imgtypes = !@imgtypes @irc.message( from, "Showing type/size info for common image types: #{@imgtypes}." ) @@ -80,7 +80,7 @@ class Title end # 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 = [ "This plugin grabs the title for any URL in the channel.", " title url Gives more verbose output in case of errors.", diff --git a/plugins/toolbox.rb b/plugins/toolbox.rb index 2fed4111ec5a8fd0a6f1e8d127eef80926b48c0c..94b8000a843142e3bb15029cb2bd5e6e5c8621d5 100644 --- a/plugins/toolbox.rb +++ b/plugins/toolbox.rb @@ -18,7 +18,7 @@ class Toolbox end # Redirect random nothing requests to help - def main( nick, user, host, from, msg, arguments, con ) + def main( nick, _user, _host, _from, _msg, _arguments, con ) line = "Not valid input. Please see the help function for valid commands." if( con ) @output.c( line + "\n" ) @@ -28,7 +28,7 @@ class Toolbox end # MD5 functions - def md5( nick, user, host, from, msg, arguments, con ) + def md5( _nick, _user, _host, from, _msg, arguments, con ) if( !arguments.nil? && !arguments.empty? ) line = Digest::MD5.hexdigest( arguments ) if( con ) @@ -39,7 +39,7 @@ class Toolbox end end - def lmd5( nick, user, host, from, msg, arguments, con ) + def lmd5( _nick, _user, _host, from, _msg, arguments, con ) if( !arguments.nil? && !arguments.empty? ) line = Net::HTTP.get( 'www.insomnia247.nl', '/hash_api.php?type=md5&hash=' + arguments ) @@ -52,7 +52,7 @@ class Toolbox end # SHA-1 functions - def sha1( nick, user, host, from, msg, arguments, con ) + def sha1( _nick, _user, _host, from, _msg, arguments, con ) if( !arguments.nil? && !arguments.empty? ) line = Digest::SHA1.hexdigest( arguments ) if( con ) @@ -63,7 +63,7 @@ class Toolbox end end - def lsha1( nick, user, host, from, msg, arguments, con ) + def lsha1( _nick, _user, _host, from, _msg, arguments, con ) if( !arguments.nil? && !arguments.empty? ) line = Net::HTTP.get( 'www.insomnia247.nl', '/hash_api.php?type=sha1&hash=' + arguments ) @@ -76,7 +76,7 @@ class Toolbox end # Dig command - def dig( nick, user, host, from, msg, arguments, con ) + def dig( _nick, _user, _host, from, _msg, arguments, con ) valid = true validtype = false @@ -271,7 +271,7 @@ class Toolbox end # Webchat IP decoder - def webchat( nick, user, host, from, msg, arguments, con ) + def webchat( _nick, _user, _host, from, _msg, arguments, con ) output = "" if( !arguments.nil? && !arguments.empty? ) arguments.gsub!( /[^a-fA-F0-9]/, "" ) @@ -298,7 +298,7 @@ class Toolbox end # Base change function - def base( nick, user, host, from, msg, arguments, con ) + def base( _nick, _user, _host, from, _msg, arguments, con ) output = "" if( !arguments.nil? && !arguments.empty? ) frombase, tobase, number = arguments.split( ' ', 3 ) @@ -326,7 +326,7 @@ class Toolbox end # (De-)HEX functions - def hex( nick, user, host, from, msg, arguments, con ) + def hex( _nick, _user, _host, from, _msg, arguments, con ) output = "" if( !arguments.nil? && !arguments.empty? ) arguments.unpack('U'*arguments.length).each do |x| @@ -345,7 +345,7 @@ class Toolbox end end - def dehex( nick, user, host, from, msg, arguments, con ) + def dehex( _nick, _user, _host, from, _msg, arguments, con ) output = "" if( !arguments.nil? && !arguments.empty? ) arguments.gsub!( /[^a-fA-F0-9]/, "" ) @@ -372,7 +372,7 @@ class Toolbox end # (De-)decimal functions - def dec( nick, user, host, from, msg, arguments, con ) + def dec( _nick, _user, _host, from, _msg, arguments, con ) output = "" if( !arguments.nil? && !arguments.empty? ) arguments.unpack('U'*arguments.length).each do |x| @@ -390,7 +390,7 @@ class Toolbox end end - def dedec( nick, user, host, from, msg, arguments, con ) + def dedec( _nick, _user, _host, from, _msg, arguments, con ) output = "" if( !arguments.nil? && !arguments.empty? ) arguments.gsub!( /[^0-9]/, " " ) @@ -417,7 +417,7 @@ class Toolbox end # 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 = [ "This plugin provides a series of simple tools.", " toolbox md5 [phrase] - Calculate md5 hash of given phrase.", diff --git a/plugins/topic.rb b/plugins/topic.rb index f5c8be3d94abe0e73540d99f9626aa5fbd323779..79a39ca76de9e632a8f293b90133941cf88aa817 100644 --- a/plugins/topic.rb +++ b/plugins/topic.rb @@ -27,7 +27,7 @@ class Topic end # Settopic command - def settopic( nick, user, host, from, msg, arguments, con ) + def settopic( nick, _user, host, from, _msg, arguments, con ) if( @config.auth( host, con ) ) if( !arguments.nil? && !arguments.empty? ) chan, topic = arguments.split( ' ', 2 ) @@ -49,7 +49,7 @@ class Topic end # Append to topic command - def append( nick, user, host, from, msg, arguments, con ) + def append( nick, _user, host, from, _msg, arguments, con ) if( @config.auth( host, con ) ) if( !arguments.nil? && !arguments.empty? ) chan, topic = arguments.split( ' ', 2 ) @@ -74,7 +74,7 @@ class Topic end # Set search query - def search( nick, user, host, from, msg, arguments, con ) + def search( nick, _user, host, from, _msg, arguments, con ) if( @config.auth( host, con ) ) if( !arguments.nil? && !arguments.empty? ) chan, search = arguments.split( ' ', 2 ) @@ -97,7 +97,7 @@ class Topic end # Do search/replace on topic - def replace( nick, user, host, from, msg, arguments, con ) + def replace( nick, _user, host, from, _msg, arguments, con ) if( @config.auth( host, con ) ) if( !arguments.nil? && !arguments.empty? ) chan, replace = arguments.split( ' ', 2 ) @@ -122,7 +122,7 @@ class Topic end # Method that receives numbered server messages like MOTD, rules, names etc. (optional) - def servermsg( servername, messagenumber, message ) + def servermsg( _servername, messagenumber, message ) # Topic reply if( messagenumber == "332" ) if( message =~ /^#{@config.nick} #{@channel} :(.+)$/ ) @@ -139,7 +139,7 @@ class Topic end # 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 = [ "Plugin to handle topics.", " topic [#chan] New topic - Set completely new topic.", diff --git a/plugins/tracker.rb b/plugins/tracker.rb index 9d75ec35e760809ae61ea3bd79f3e53f6d04fe0b..b972e839e665cf697ad6b6b640bc9969e626312b 100644 --- a/plugins/tracker.rb +++ b/plugins/tracker.rb @@ -44,12 +44,12 @@ class Tracker end # 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 ) @irc.message( from, "This module will allow live tracking data to be used by nanobot." ) end # Method stop data collection - def stop( nick, user, host, from, msg, arguments, con ) + def stop( _nick, _user, host, from, _msg, _arguments, con ) if( @config.auth( host, con ) ) if( @status.threads && @config.threads) @ftread.exit @@ -71,7 +71,7 @@ class Tracker # 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 = [ "This is a plugin that tracks Cool_Fire.", " tracker stop Tell it to gracfully stop the update thread." diff --git a/plugins/translate.rb b/plugins/translate.rb index 4148cb6a30ef1e5ce6f680bf8f67ca9e4c6d976f..9b19feb7e0354d47eb3b81fcb2fbacff11e2b4de 100644 --- a/plugins/translate.rb +++ b/plugins/translate.rb @@ -24,7 +24,7 @@ class Translate end # Function to translate from one language to another - def to( nick, user, host, from, msg, arguments, con ) + def to( _nick, _user, _host, from, _msg, arguments, con ) if( !arguments.nil? && !arguments.empty? ) to, string = arguments.split( ' ', 2 ) @@ -63,7 +63,7 @@ class Translate end # Function to detect the language of a provided string - def detect( nick, user, host, from, msg, arguments, con ) + def detect( _nick, _user, _host, from, _msg, arguments, con ) if( !arguments.nil? && !arguments.empty? ) arguments.gsub!( / /, "%20" ) # Replace spaces arguments.gsub!( /&/, "" ) # Sanitize GET variables @@ -91,7 +91,7 @@ class Translate end # Function to send help about this plugin - def help( nick, user, host, from, msg, arguments, con ) + def help( nick, _user, _host, _from, _msg, _arguments, con ) help = [ "This plugin provides an interface to the Bing! translate API.", " translate to [lang] [phrase] - Translate a given phrase into another language.", diff --git a/plugins/twit.rb b/plugins/twit.rb index ee238e46da81408cf4a3719cec0e69561dd43f43..f2df628b12dee65c0063cf94ef371ff9bbfa6938 100644 --- a/plugins/twit.rb +++ b/plugins/twit.rb @@ -17,7 +17,7 @@ class Twit @output = output @irc = irc @timer = timer - + # Set up twitter gem tokens & keys @tokenfile = "twitter.json" @consumer_key = nil @@ -87,12 +87,12 @@ class Twit end # Method that receives a notification when a user is kicked (optional) - def getlast( nick, user, host, from, msg, arguments, con ) + def getlast( _nick, _user, _host, from, _msg, arguments, con ) if( !arguments.nil? && !arguments.empty? ) arguments.gsub!( /&/, "" ) # Sanitize GET variables result = @client.user_timeline( arguments ).first.text - + if( result.empty? ) result = "Error: No result." else @@ -110,14 +110,14 @@ class Twit end # Method to add users to follow - def follow( nick, user, host, from, msg, arguments, con ) + def follow( _nick, _user, host, from, _msg, arguments, con ) if( @config.auth( host, con ) ) if( @status.threads && @config.threads) if( !arguments.nil? && !arguments.empty? ) arguments.gsub!( /&/, "" ) # Sanitize GET variables - + line = @client.user_timeline( arguments ).first.text - + if( !line.empty? ) @follow[ arguments ] = line line = "Following: #{arguments}: #{line}" @@ -146,7 +146,7 @@ class Twit end # Method to delete users to follow - def unfollow( nick, user, host, from, msg, arguments, con ) + def unfollow( _nick, _user, host, from, _msg, arguments, con ) if( @config.auth( host, con ) ) if( @status.threads && @config.threads) if( !arguments.nil? && !arguments.empty? ) @@ -182,7 +182,7 @@ class Twit end # Method stop feed collection - def stop( nick, user, host, from, msg, arguments, con ) + def stop( _nick, _user, host, from, _msg, _arguments, con ) if( @config.auth( host, con ) ) if( @status.threads && @config.threads) @ftread.exit @@ -203,9 +203,9 @@ class Twit end # Method stop feed collection - def tweet( nick, user, host, from, msg, arguments, con ) + def tweet( nick, _user, host, _from, _msg, arguments, con ) if( @config.auth( host, con ) ) - + @client.update( arguments ) line = "Tweet sent." @@ -219,7 +219,7 @@ class Twit end # Set channel for feeds - def channel( nick, user, host, from, msg, arguments, con ) + def channel( _nick, _user, host, from, _msg, arguments, con ) if( @config.auth( host, con ) ) if( !arguments.nil? && !arguments.empty? ) if( @status.threads && @config.threads) @@ -244,7 +244,7 @@ class Twit end # Show list of accounts being followed - def following( nick, user, host, from, msg, arguments, con ) + def following( nick, _user, _host, _from, _msg, _arguments, con ) line = "" if( @status.threads && @config.threads) @follow.each do |usr, _last| @@ -262,7 +262,7 @@ class Twit end # 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 = [ "This plugin retrieves the last message from a users twitter feed.", " twit getlast [twittername] - Public plugin function.", @@ -333,7 +333,7 @@ class Twit @follow.each do |user, last| begin line = @client.user_timeline( user ).first.text - + # Check for failure to fetch feed data. if( !line.empty? ) @@ -360,13 +360,13 @@ class Twit sleep( @freq ) end end - + # JSON parser routine def jsonparse( doc ) doc = JSON.parse( doc ) - + doc = doc[ "results" ][ 0 ] - + if( doc.instance_of? NilClass ) return "" else @@ -375,19 +375,14 @@ class Twit @specials.each_key do |key| doc.gsub!( key, @specials[key] ) end - - return doc + doc end - - # Mark object for garbage collection - doc = nil end - + # XML parser routine (No longer used) def xmlparse( xmldoc ) xmldoc = Nokogiri::XML( xmldoc ) - - title = xmldoc.at_xpath( "//item/title" ) + title = xmldoc.at_xpath( "//item/title" ) if( title.instance_of? NilClass ) return "" @@ -397,8 +392,7 @@ class Twit @specials.each_key do |key| line.gsub!( key, @specials[key] ) end - - return line + line end end end diff --git a/plugins/youtube.rb b/plugins/youtube.rb index f43e3105223214b239f3a906d44438fe9c4d9883..fa7e8c438b10cd10e87ab4dd6751bcfc4615335c 100644 --- a/plugins/youtube.rb +++ b/plugins/youtube.rb @@ -23,7 +23,7 @@ class Youtube end # Default method - def main( nick, user, host, from, msg, arguments, con ) + def main( _nick, _user, _host, from, _msg, arguments, _con ) video_id = nil title = nil categoryid = nil @@ -35,7 +35,7 @@ class Youtube # See what sort of link we're dealing with and extract video id accordingly if( arguments =~ /youtube\.com/ ) - if( arguments =~ /v=([a-zA-Z0-9\-_]{11})/ ) + if( arguments =~ /v=([a-zA-Z0-9\-_]{11})/ ) video_id = $1 end elsif( arguments =~ /youtu\.be\/([a-zA-Z0-9\-_]{11})/ ) @@ -44,7 +44,7 @@ class Youtube # Retreive title and categoryId host = @api_host_video.gsub(/%ID%/, video_id) - host = host.gsub!(/%PART%/, 'snippet') + host.gsub!(/%PART%/, 'snippet') uri = URI(host) Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http| @@ -101,7 +101,7 @@ class Youtube end # Download video and transcode - def mp3( nick, user, host, from, msg, arguments, con ) + def mp3( _nick, _user, _host, from, _msg, arguments, _con ) # Check for valid url if( arguments =~ /\A#{URI::regexp(['http', 'https'])}\z/ ) @@ -132,7 +132,7 @@ class Youtube end # 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 = [ "Plugin to retreive data from youtube videos", " youtube url - Grab data for youtube video.", diff --git a/startup.rb b/startup.rb index 27b3fdb37dcf7d18b42672b03995c3139e6882ee..6e09b162ecbca07440dbd9cf169311641d31b877 100644 --- a/startup.rb +++ b/startup.rb @@ -50,7 +50,6 @@ class Startup def checkthreads @output.std( "Checking for threading support ... " ) begin - require 'thread' @status.threads( 1 ) @output.good( "[OK]" ) @@ -62,7 +61,7 @@ class Startup rescue LoadError @status.threads( 0 ) - + @output.bad( "[NO]" ) if( @config.threads ) @output.bad( "\n" )