Public feed #888560

Something

public text v1 · immutable
Raw Edit
·published 2008-02-02 06:22 UTC
rendered paste body
message_callbacks["eval"] = {}										
message_callbacks["eval"].Command  = "$eval"
message_callbacks["eval"].Function =	function( channel, from, message )
											local teststring = string.gsub( message, "%s", "" )
											
											for k, v in pairs( superbadwords ) do
												if string.find( teststring, v ) then
													irc.notice( from, "Sorry, '"..v.."' has been blocked." )
													return false
												end
											end

											for k, v in pairs( badwords ) do
												if string.find( teststring, v .. "%p" ) then
													irc.notice( from, "Sorry, '"..v.."' has been blocked for security reasons." )
													return false
												end
											end
											
											results  = nil
											message = "return " .. message
											
											worked, results = pcall( loadstring(message) )	

											if worked then
												--if string.lower( type( results ) ) ~= "table" then
													irc.say( channel, tostring( results ) )
												--else
												--	PrintTable( channel, results )
												--end
											else
												irc.notice( from, "ERROR: " .. tostring( results ) )
											end
										end