How to properly make an "API" for my addon

So I’m currently creating an anti-spam addon and I have the chat commands in the main lua file. I was wondering how I could give said chat commands their own file or make an “API” out of them. Below are the commands and the two functions needed to check the params for them.



--[[Check Boolean Function]]--
local function CheckBooleanFunc( input )
	if(input == "on") then // if input = !ras on
	   return true //the boolean returns true
	elseif(input == "off") then //if input = !ras off
	   return false //the boolean returns false
	end
end

--[[Check Numbers Function]]--
local function CheckNumberFunc( input )
	if ( type(tonumber(input)) == "number" ) then //if the input is an actual number
		if ( tonumber(input) >= 0 ) then //then if the input is a number that is >= 0
			return tonumber(input) //the function returns the number
		elseif ( tonumber(input) < 0 ) then //otherwise the function will return 1
			return '1'
		end
	end
end

--[[Enable-Disable Chat Commands]]--
hook.Add( "PlayerSay", "RASChatCommands", function( ply, text, public )
    text = string.lower( text )
    text = string.Explode( " ", text )

	if ( #text > 1 and text[1] == "!ras" ) then
		if ply:IsSuperAdmin() then
			if ( text[2] == "on" ) then
				RAS.Settings.AntiSpamming = true //Change das value.
				RAS.ChatPrint( "Anti-Spam has been enabled by "..ply:Nick() )
				RAS.Log( "Enabled by "..ply:Nick() )
				return ''
			elseif ( text[2] == "off" ) then
				RAS.Settings.AntiSpamming = false
				RAS.ChatPrint( "Anti-Spam has been disabled by "..ply:Nick() )
				RAS.Log( "Disabled by "..ply:Nick() )
				return ''
			elseif ( text[2] == "chat" ) then
				RAS.Settings.Chat.Enabled = CheckBooleanFunc( text[3] )
				RAS.ChatPrint( "Chat spam protection has been set to "..text[3].."!" )
				RAS.Log( "Chat Protection set to "..text[3].." by "..ply:Nick() )
				return ''
			elseif ( text[2] == "props" ) then
				RAS.Settings.Prop.Enabled = CheckBooleanFunc( text[3] )
				RAS.ChatPrint( "Prop spam protection has been set to "..text[3].."!" )
				RAS.Log( "Prop Protection set to "..text[3].." by "..ply:Nick() )
				return ''
			elseif ( text[2] == "sents" ) then
				RAS.Settings.Sent.Enabled = CheckBooleanFunc( text[3] )
				RAS.ChatPrint( "Scripted Ents spam protection has been set to "..text[3].."!" )
				RAS.Log( "Scripted Ent Protection set to "..text[3].." by "..ply:Nick() )
				return ''
			elseif ( text[2] == "effects" ) then
				RAS.Settings.Effect.Enabled = CheckBooleanFunc( text[3] )
				RAS.ChatPrint( "Effect spam protection has been set to "..text[3].."!" )
				RAS.Log( "Effect Protection set to "..text[3].." by "..ply:Nick() )
				return ''
			elseif ( text[2] == "ragdolls" ) then
				RAS.Settings.Ragdoll.Enabled = CheckBooleanFunc( text[3] )
				RAS.ChatPrint( "Ragdoll spam protection has been set to "..text[3].."!" )
				RAS.Log( "Ragdoll Protection set to "..text[3].." by "..ply:Nick() )
				return ''
			elseif ( text[2] == "vehicles" ) then
				RAS.Settings.Vehicle.Enabled = CheckBooleanFunc( text[3] )
				RAS.ChatPrint( "Vehicle spam protection has been set to "..text[3].."!" )
				RAS.Log( "Vehicle Protection set to "..text[3].." by "..ply:Nick() )
				return ''
			elseif ( text[2] == "npc" ) then
				RAS.Settings.Npc.Enabled = CheckBooleanFunc( text[3] )
				RAS.ChatPrint( "NPC spam protection has been set to "..text[3].."!" )
				RAS.Log( "NPC Protection set to "..text[3].." by "..ply:Nick() )
				return ''
			elseif ( text[2] == "log" ) then
				RAS.Settings.Logging.Enabled = CheckBooleanFunc( text[3] )
				RAS.ChatPrint( "Logging has been enabled "..text[3].."!" )
				RAS.Log( "Logging set to "..text[3].." by "..ply:Nick() )
				return ''
			elseif ( text[2] == "chatdelay" && tonumber(text[3]) ~= nil ) then
				RAS.Settings.Chat.Delay = CheckNumberFunc(text[3])
				RAS.ChatPrint( "Chat spam delay is set to "..text[3].." seconds!" )
				RAS.Log( "Chat Protection delay set to "..text[3].." seconds by "..ply:Nick() )
				return ''
			elseif ( text[2] == "propdelay" && tonumber(text[3]) ~= nil ) then
				RAS.Settings.Prop.Delay = CheckNumberFunc(text[3])
				RAS.ChatPrint( "Prop spam delay is set to "..text[3].." seconds!" )
				RAS.Log( "Prop Protection delay set to "..text[3].." seconds by "..ply:Nick() )
				return ''
			elseif ( text[2] == "sentdelay" && tonumber(text[3]) ~= nil ) then
				RAS.Settings.Sent.Delay = CheckNumberFunc(text[3])
				RAS.ChatPrint( "Scripted Ent spam delay is set to "..text[3].." seconds!" )
				RAS.Log( "Scripted Ent Protection delay set to "..text[3].." seconds by "..ply:Nick() )
				return ''
			elseif ( text[2] == "effectdelay" && tonumber(text[3]) ~= nil ) then
				RAS.Settings.Effect.Delay = CheckNumberFunc(text[3])
				RAS.ChatPrint( "Effect spam delay is set to "..text[3].." seconds!" )
				RAS.Log( "Effect Protection delay set to "..text[3].." seconds by "..ply:Nick() )
				return ''
			elseif ( text[2] == "ragdolldelay" && tonumber(text[3]) ~= nil ) then
				RAS.Settings.Ragdoll.Delay = CheckNumberFunc(text[3])
				RAS.ChatPrint( "Ragdoll spam delay is set to "..text[3].." seconds!" )
				RAS.Log( "Ragdoll Protection delay set to "..text[3].." seconds by "..ply:Nick() )
				return ''
			elseif ( text[2] == "vehicledelay" && tonumber(text[3]) ~= nil ) then
				RAS.Settings.Vehicle.Delay = CheckNumberFunc(text[3])
				RAS.ChatPrint( "Vehicle spam delay is set to "..text[3].." seconds!" )
				RAS.Log( "Vehicle Protection delay set to "..text[3].." seconds by "..ply:Nick() )
				return ''
			elseif ( text[2] == "npcdelay" && tonumber(text[3]) ~= nil ) then
				RAS.Settings.Npc.Delay = CheckNumberFunc(text[3])
				RAS.ChatPrint( "NPC spam delay is set to "..text[3].." seconds!" )
				RAS.Log( "NPC Protection delay set to "..text[3].." seconds by "..ply:Nick() )
				return ''
			end
			SettingsSave()
		else
			RAS.ChatPrint( "You do not have permission to do this!", ply )
		end
	end
end)